[PATCH] ccan: Fix calling memset with zero length parameter.

Andreas Schneider asn at samba.org
Thu Jul 11 05:36:54 MDT 2013


Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/ccan/tally/tally.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/ccan/tally/tally.c b/lib/ccan/tally/tally.c
index 774373c..395c17c 100644
--- a/lib/ccan/tally/tally.c
+++ b/lib/ccan/tally/tally.c
@@ -510,7 +510,9 @@ char *tally_histogram(const struct tally *tally,
 			count = 0;
 		}
 
-		memset(p, '*', count);
+		if (count > 0) {
+			memset(p, '*', count);
+		}
 		p += count;
 		*p = '\n';
 		p++;
-- 
1.8.3.1




More information about the samba-technical mailing list