The Product Revision Level field in the SCSI inquiry data has a fixed
length of 4 bytes. When copying it as a null-terminated string, place
the null terminator in the correct position; currently the string has
an extra character that is never initialized in memory.
Reduce the length of each string buffer, so it does not extend beyond
the null terminator.
Fixes:
microtek.c: In function ‘MDBG_INIT’:
microtek.c:163:3: error: unknown type name ‘va_list’
163 | va_list ap;
| ^~~~~~~
microtek.c:78:1: note: ‘va_list’ is defined in header ‘<stdarg.h>’; did you forget to ‘#include <stdarg.h>’?
77 | #include "microtek.h"
+++ |+#include <stdarg.h>
78 |
microtek.c:164:3: warning: implicit declaration of function ‘va_start’; did you mean ‘sane_start’? [-Wimplicit-function-declaration]
164 | va_start(ap, format);
| ^~~~~~~~
| sane_start
microtek.c:165:54: warning: passing argument 4 of ‘vsnprintf’ makes pointer from integer without a cast [-Wint-conversion]
165 | vsnprintf(_mdebug_string, MAX_MDBG_LENGTH, format, ap);
| ^~
| |
| int
In file included from ../include/sane/sanei_config.h:50,
from microtek.c:70:
.../host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/stdio.h:359:57: note: expected ‘__va_list_tag *’ but argument is of type ‘int’
359 | const char *__restrict __format, __gnuc_va_list __arg)
| ~~~~~~~~~~~~~~~^~~~~
microtek.c:166:3: warning: implicit declaration of function ‘va_end’ [-Wimplicit-function-declaration]
166 | va_end(ap);
| ^~~~~~
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Backends use a mixture of SANE_CURRENT_{MAJOR | MINOR} and V_{MAJOR |
MINOR} with all kind of permutations. I was confused by this and one
comment in pieusb.c tells me I was not alone. Some items in old
changelogs suggest to use the SANE_CURRENT_ macros in backends, so let's
switch to do that with the exception of net.c and dll.c. Done with:
$ find backend -name '*.[ch]' | xargs sed -i '/nearly every/ ! { s/\<V_M/SANE_CURRENT_M/g }'
$ git checkout backend/net.c backend/dll.c
And manually removing the comment from pieusb.c. Everything still builds
fine.
With the exception of use in three quotes as well as our inlcuded copy
of the GPL, all use of the Free Software Foundation's postal address
has been removed.
Re #320.
Source code was inconsistent on how they were referencing
include files in include/sane. In certain cases, sane/sane.h
and sane/saneopts.h was really including external copies (with
some preprocessor implementations anyways).
Global replace of u_int??_t with C9x standard based uintxx_t
in order to remove some tricky and overlapping portability logic
from acinclude.m4 and leave it in only m4/stdint.m4.
to copy it over and over again. Changed header inclusion order in backend
files to include backend.h after sanei_backend.h. Based on a patch from stef
<stef-listes@wanadoo.fr>.
* doc/descriptions/microtek.desc: Updated version number.
* backend/microtek.c:
Fixed bug in sane_read() [had failed to set return length to zero
in non-STATUS_GOOD conditions].
Fixed bug in sane_set_io_mode() [had returned SANE_STATUS_UNSUPPORTED
if blocking mode was requested].
Bumped version up to 0.13.1.
Updated (status keywords, mostly).
* backend/microtek.c:
* backend/microtek.h:
Replaced fprintf()/printf() with various DBG() statements.
Removed #include <stdio.h>!
Eliminated a few "unused parameter" compiler warnings.
Updated the copyright date.
Bumped version up to lucky 0.13.0
o Use 'expanded contrast/exposure settings' inquiry data to dynamically
set ranges for those options.
o Incorporate patches for Polaroid SprintScan 35LE (from Dick Bruijn)
- added "Polaroid" vendor string
- screwed around with 'brightness' setting
- attached 'negative scan' button
o sane_exit() now frees the devlist allocated by sane_get_devices()
o upped version to 0.12.2