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

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Jul 11 05:47:46 MDT 2013


On Thu, Jul 11, 2013 at 01:36:54PM +0200, Andreas Schneider wrote:
> 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++;

Hmmm. That's not allowed?

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list