[sane-devel] Garbage after device names?

Henning Meier-Geinitz henning@meier-geinitz.de
Fri, 25 Oct 2002 13:49:54 +0200


Hi,

On Fri, Oct 25, 2002 at 01:00:23PM +0000, Diego Zuccato wrote:
> Well, I noticed that xsane couldn't "remember" device settings.

xsane uses vendor:model.drc for the file names and doesn't seem to
save the device file name. So you are talking about the vendor name?

> Investigating a bit I discovered that it gets the wrong device,
> so it saves files with trailing spurious characters that change
> between executions.

Which backend/scanner do you use?

> At a first look it seemed an xsane problem, but then I could
> get a wrong name from scanimage -L (since the spurious characters are
> non-printable, a simple screen output was not enough... have had to
> redirect to a file and then look at it with mcedit).

Maybe the backend gets the vendor directly from the SCSI inquiry? If
it does that, it should really check for non-printable characters
and other oddities before.

> At this point, I think that it's a bug either in the SCSI layer (GASP!)

The original problem may be either the device returning garbage or the
SCSI driver generating garbage :-/

> or in sane. Shouldn't sane itself truncate too long device names?

As the length of the SCSI vendor/product strings are fixed, truncating
the string and setting a final 0 wouldn't hurt.

> That behaviour is the same that is reproducible with :

So you think your backend copies a string with str(n)cpy without
making sure, that the resulting string is zero-terminated?

Bye,
  Henning