zero size memset

Dirk Engling erdgeist at erdgeist.org
Thu Jan 22 21:11:47 UTC 2015


Dear fellow hackers,

knowing that the memset API tends to be hard to remember from time to
time, I grepped the FreeBSD source for occurences of memset with a
length parameter of 0 and a character parameter that should have been a
length and found the following:

./contrib/gdb/gdb/remote.c:    memset (regs, rs->sizeof_g_packet, 0);
./contrib/gdb/gdb/std-regs.c:  memset (buf, TYPE_LENGTH (VALUE_TYPE
(val)), 0);
./contrib/gdb/gdb/std-regs.c:   memset (buf, TYPE_LENGTH (VALUE_TYPE
(val)), 0);
./contrib/gdb/gdb/std-regs.c:   memset (buf, TYPE_LENGTH (VALUE_TYPE
(val)), 0);

Whom to nudge to have this fixed?

I also grepped the tree for occurences of x = realloc(x ... but found
too many of them to check all instances if they properly abort() when x
is NULL. Does anyone know how to exclude false positives here?

TIA,

  erdgeist


More information about the freebsd-hackers mailing list