From: Alan Jenkins Date: Wed, 5 Jul 2017 22:52:17 +0000 (+0100) Subject: fix wrong printf specifier X-Git-Tag: v1.7.1~123^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee732d99260e96fe139e1f7fd82d6db3a698389c;p=thirdparty%2Frrdtool-1.x.git fix wrong printf specifier $ cd tests && ./list1 ... ERROR: rrdcached@���������������������������������������������������������� ��������������������������������������������正1: Usage: LIST [RECURSIVE] /[] under valgrind: ==16450== Conditional jump or move depends on uninitialised value(s) ==16450== at 0x4C356A9: wcslen (vg_replace_strmem.c:1848) ==16450== by 0x535C953: wcsrtombs (in /usr/lib64/libc-2.24.so) ==16450== by 0x52FFFC4: vfprintf (in /usr/lib64/libc-2.24.so) ==16450== by 0x5328448: vsnprintf (in /usr/lib64/libc-2.24.so) ==16450== by 0x4E6C848: rrd_set_error (rrd_error.c:51) ==16450== by 0x4E6E113: response_read.constprop.5 (rrd_client.c:577) ==16450== by 0x4E6E251: request.constprop.3 (rrd_client.c:659) ==16450== by 0x4E6F319: rrd_client_list (rrd_client.c:1354) ==16450== by 0x4E6F567: rrdc_list (rrd_client.c:1412) ==16450== by 0x4E485C8: rrd_list (rrd_list.c:308) ==16450== by 0x402D07: HandleInputLine (rrd_tool.c:696) ==16450== by 0x40158B: main (rrd_tool.c:551) ==16450== ==16450== Invalid read of size 4 ==16450== at 0x4C356A4: wcslen (vg_replace_strmem.c:1848) ==16450== by 0x535C953: wcsrtombs (in /usr/lib64/libc-2.24.so) ==16450== by 0x52FFFC4: vfprintf (in /usr/lib64/libc-2.24.so) ==16450== by 0x5328448: vsnprintf (in /usr/lib64/libc-2.24.so) ==16450== by 0x4E6C848: rrd_set_error (rrd_error.c:51) ==16450== by 0x4E6E113: response_read.constprop.5 (rrd_client.c:577) ==16450== by 0x4E6E251: request.constprop.3 (rrd_client.c:659) ==16450== by 0x4E6F319: rrd_client_list (rrd_client.c:1354) ==16450== by 0x4E6F567: rrdc_list (rrd_client.c:1412) ==16450== by 0x4E485C8: rrd_list (rrd_list.c:308) ==16450== by 0x402D07: HandleInputLine (rrd_tool.c:696) ==16450== by 0x40158B: main (rrd_tool.c:551) ... $ man 3 printf ... Conversion specifiers ... S (Not in C99 or C11, but in SUSv2, SUSv3, and SUSv4.) Synonym for ls. Don't use. ... s If an l modifier is present: The const wchar_t * argument is expected to be a pointer to an array of wide characters. --- diff --git a/src/rrd_client.c b/src/rrd_client.c index e0278da3..0ac08ef2 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -574,7 +574,7 @@ static int response_read(rrd_client_t *client, rrdc_response_t **ret_response) / if (ret->status <= 0) { if (ret->status < 0) - rrd_set_error("rrdcached@%S: %s", client->sd_path, ret->message); + rrd_set_error("rrdcached@%s: %s", client->sd_path, ret->message); goto out; }