]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
fix wrong printf specifier
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Wed, 5 Jul 2017 22:52:17 +0000 (23:52 +0100)
committerAlan Jenkins <alan.christopher.jenkins@gmail.com>
Wed, 5 Jul 2017 22:52:17 +0000 (23:52 +0100)
$ cd tests && ./list1
...
ERROR: rrdcached@����������������������������������������������������������
��������������������������������������������正1: Usage: LIST [RECURSIVE]
/[<path>]

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.

src/rrd_client.c

index e0278da3fac169a219cb1db2ce936dc14c9bfaad..0ac08ef24024ba877bdff29d77266959da7326e1 100644 (file)
@@ -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;
   }