[sane-devel] Garbage after device names?

Diego Zuccato diego at otello.alma.unibo.it
Sat Oct 26 11:33:52 BST 2002


Henning Meier-Geinitz wrote:

>   str = malloc (16 + 1);
>   memset (str, 0, sizeof (str));
malloc+memset => calloc
But:
   str[16]=0;
should be enough. No need to zero-out memory you're going to overwrite
immediatly.

> The memset won't work because sizeof (str) is always 4 (on 32 bit
> platforms). And if ibug doesn't contain any zeros --> bang.
Exactly. And it shouldn't contain it, IIUC. Shouldn't it be space-padded
to 16 chars?

Tks,
 Diego.



More information about the sane-devel mailing list