[sane-devel] Fix for array subscript error in niash.c
Johannes Meixner
jsmeix at suse.de
Wed Feb 21 16:33:52 CET 2007
Hello,
the newest GNU compiler found an array subscript error
in backend/niash.c of sane-backends-1.0.18, see
https://bugzilla.novell.com/show_bug.cgi?id=246654
It happens because the arrays are defined with a size of optLast
but actually optLast is not the last entry in the enumeration.
Therefore I added an optEndOfList at the very end:
--------------------------------------------------------------------
--- backend/niash.c.orig 2006-02-04 12:34:28.000000000 +0100
+++ backend/niash.c 2007-02-21 15:38:12.000000000 +0100
@@ -89,7 +89,9 @@ typedef enum
optLamp,
optCalibrate,
- optGamma /* analog gamma = single number */
+ optGamma, /* analog gamma = single number */
+/* have optEndOfList only to define arrays with sufficient size */
+ optEndOfList
} EOptionIndex;
@@ -105,8 +107,8 @@ typedef union
typedef struct
{
- SANE_Option_Descriptor aOptions[optLast];
- TOptionValue aValues[optLast];
+ SANE_Option_Descriptor aOptions[optEndOfList];
+ TOptionValue aValues[optEndOfList];
TScanParams ScanParams;
THWParams HWParams;
--------------------------------------------------------------------
Kind Regards
Johannes Meixner
--
SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
AG Nuernberg, HRB 16746, GF: Markus Rex
More information about the sane-devel
mailing list