[sane-devel] sane-frontends: "array subscript out of range" error
Johannes Meixner
jsmeix at suse.de
Tue Jan 17 16:11:30 UTC 2006
Hello,
buf[sizeof(buf)] is always out of range.
A customer reported the following out of range problem:
---------------------------------------------------------------------------
--- src/xscanimage.c.orig 2006-01-17 16:06:16.000000000 +0100
+++ src/xscanimage.c 2006-01-17 16:32:42.000000000 +0100
@@ -1284,7 +1284,7 @@
{ /* We are running in standalone mode */
/* test for pnm formats */
strncpy (testfilename, preferences.filename, sizeof (testfilename));
- testfilename[sizeof (testfilename)] = 0;
+ testfilename[sizeof (testfilename) - 1] = 0;
g_strreverse (testfilename);
if (!((!strncmp (testfilename, "mnp.", 4)) ||
(!strncmp (testfilename, "mgp.", 4)) ||
---------------------------------------------------------------------------
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