pidgin/pidgin

Fix string size specifier in debug prints

19 months ago, Elliott Sales de Andrade
c67c45d70006
Parents e0a90a0a5bb2
Children 36684da1e60d
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);
}