ccan: Fix calling memset with zero length parameter
authorVolker Lendecke <vl@samba.org>
Thu, 11 Jul 2013 12:57:53 +0000 (14:57 +0200)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 15 Jul 2013 05:10:03 +0000 (14:40 +0930)
Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/tally/tally.c

index 774373ca0f88e0b4a48bed5029107cf28bded0d1..29f055588015f5e38f02513c6dcce39b4657ff20 100644 (file)
@@ -506,11 +506,11 @@ char *tally_histogram(const struct tally *tally,
 
                if (count > covered) {
                        count -= covered;
 
                if (count > covered) {
                        count -= covered;
+                       memset(p, '*', count);
                } else {
                        count = 0;
                }
 
                } else {
                        count = 0;
                }
 
-               memset(p, '*', count);
                p += count;
                *p = '\n';
                p++;
                p += count;
                *p = '\n';
                p++;