Possibly misordered arguments to memset(3)

Cy Schubert Cy.Schubert at komquats.com
Wed Dec 13 20:06:09 UTC 2017


In message <20171213190230.gf5gax7vswakgrd4 at t240>, Michael McConville 
writes:
> I can't claim to understand this function, but it seems unlikely that the
> current ordering of the arguments was intentional.
>
> Thanks for your time,
> Michael McConville
> University of Utah
>
> diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c
> index 168e022cfba..6946ac3ba0e 100644
> --- a/tools/tools/netmap/pkt-gen.c
> +++ b/tools/tools/netmap/pkt-gen.c
> @@ -612,7 +612,7 @@ dump_payload(const char *_p, int len, struct netmap_ring 
> *ring, int cur)
>  		ring->slot[cur].flags, len);
>  	/* hexdump routine */
>  	for (i = 0; i < len; ) {
> -		memset(buf, sizeof(buf), ' ');
> +		memset(buf, ' ', sizeof(buf));
>  		sprintf(buf, "%5d: ", i);
>  		i0 = i;
>  		for (j=0; j < 16 && i < len; i++, j++)

Good catch. Looks like it's been corrected already.


-- 
Cheers,
Cy Schubert <Cy.Schubert at cschubert.com>
FreeBSD UNIX:  <cy at FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.




More information about the freebsd-hackers mailing list