[sane-devel] Bug in scanimage.c + Patch
    abel deuring 
    a.deuring at satzbau-gmbh.de
       
    Wed Mar 20 18:17:47 GMT 2002
    
    
  
Klaas Freitag wrote:
> 
> Hi,
> 
> I think there is a small bug in the code handling the -f option. IMHO it mallocs
> a one byte to small buffer for a strcpy action. I could reproduce some crashes
> which disappeared after having applied the attached patch.
> 
> If you agree, please apply the patch.
Klaas,
right, the malloc argument was too small, but that's already fixed in
the CVS version: 
fmt = malloc(strlen(optarg)+1);
strdup would work too, but you should not remove the strcpy call in the
"for (i = 0; device_list[i]; ++i)" loop; without the strcpy, the "switch
(*percent)" will work only for the first pass of the loop.
Abel
    
    
More information about the sane-devel
mailing list