Fri, 04 Nov 2022 02:32:53 -0500
Fix string size specifier in debug prints
The `%*s` specifies the *width* of the string, but this was intended to specify
the maximum number of characters (in case the `GBytes` was unterminated), which is `%.*s`.
Testing Done:
Compiled only, though I did write a small test program with `printf` to confirm that this worked the intended way.
Reviewed at https://reviews.imfreedom.org/r/2023/
--- a/libpurple/protocols/gg/avatar.c Fri Nov 04 00:47:21 2022 -0500 +++ b/libpurple/protocols/gg/avatar.c Fri Nov 04 02:32:53 2022 -0500 @@ -274,7 +274,7 @@ } buffer = g_bytes_get_data(response_body, &size); - purple_debug_info("gg", "ggp_avatar_own_sent: %*s", (int)size, buffer); + purple_debug_info("gg", "ggp_avatar_own_sent: %.*s", (int)size, buffer); g_bytes_unref(response_body); }
--- a/libpurple/protocols/gg/pubdir-prpl.c Fri Nov 04 00:47:21 2022 -0500 +++ b/libpurple/protocols/gg/pubdir-prpl.c Fri Nov 04 02:32:53 2022 -0500 @@ -165,7 +165,7 @@ xml_raw = g_bytes_unref_to_data(response_body, &xml_size); if (purple_debug_is_verbose() && purple_debug_is_unsafe()) { - purple_debug_misc("gg", "ggp_pubdir_got_data: xml=[%*s]", + purple_debug_misc("gg", "ggp_pubdir_got_data: xml=[%.*s]", (int)xml_size, xml_raw); } @@ -806,7 +806,7 @@ } buffer = g_bytes_get_data(response_body, &size); - purple_debug_info("gg", "ggp_pubdir_set_info_got_response: [%*s]", + purple_debug_info("gg", "ggp_pubdir_set_info_got_response: [%.*s]", (int)size, buffer); /* <result><status>0</status></result> */
--- a/libpurple/protocols/jabber/bosh.c Fri Nov 04 00:47:21 2022 -0500 +++ b/libpurple/protocols/jabber/bosh.c Fri Nov 04 02:32:53 2022 -0500 @@ -246,7 +246,7 @@ gsize length = 0; body = g_bytes_get_data(response_body, &length); - purple_debug_misc("jabber-bosh", "received: %*s", (int)length, body); + purple_debug_misc("jabber-bosh", "received: %.*s", (int)length, body); } node = jabber_bosh_connection_parse(bosh_conn, msg, response_body, error); @@ -430,7 +430,7 @@ gsize length = 0; body = g_bytes_get_data(response_body, &length); - purple_debug_misc("jabber-bosh", "received (session creation): %*s", + purple_debug_misc("jabber-bosh", "received (session creation): %.*s", (int)length, body); }