[sane-devel] Fix for array subscript error in sanei_ab306.c
Johannes Meixner
jsmeix at suse.de
Wed Jan 31 14:51:29 CET 2007
Hello,
the newest GNU compiler found an array subscript error
in sanei/sanei_ab306.c of sane-backends-1.0.18, see
https://bugzilla.novell.com/show_bug.cgi?id=239953
It happens if the value of "base" is none of the listed values
in the "port" array because in this case i == 8 from the "for"
statement above.
This is a fix:
---------------------------------------------------------------------------
--- sanei/sanei_ab306.c.orig 2007-01-31 14:13:16.000000000 +0100
+++ sanei/sanei_ab306.c 2007-01-31 14:38:26.000000000 +0100
@@ -273,7 +273,7 @@ sanei_ab306_open (const char *dev, int *
if (port[i].base == base)
break;
- if (port[i].base != base)
+ if (i >= NELEMS(port))
{
DBG(1, "sanei_ab306_open: %lx is not a valid base address\n", base);
return SANE_STATUS_INVAL;
---------------------------------------------------------------------------
Kind Regards
Johannes Meixner
--
SUSE LINUX Products GmbH, Maxfeldstrasse 5 Mail: jsmeix at suse.de
90409 Nuernberg, Germany WWW: http://www.suse.de/
More information about the sane-devel
mailing list