diff --git a/backend/ma1509.c b/backend/ma1509.c index 472269005..3c6a6bb9a 100644 --- a/backend/ma1509.c +++ b/backend/ma1509.c @@ -48,7 +48,7 @@ /**************************************************************************/ /* ma1509 backend version */ -#define BUILD 2 +#define BUILD 3 /**************************************************************************/ #include "../include/sane/config.h" @@ -1165,6 +1165,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) word = 0; cp = sanei_config_get_string (cp, &word); + if (!word) + { + DBG (1, "sane_init: config file line %d: missing quotation mark?\n", + linenumber); + continue; + } if (strcmp (word, "warmup-time") == 0) { @@ -1173,6 +1179,14 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) free (word); word = 0; cp = sanei_config_get_string (cp, &word); + + if (!word) + { + DBG (1, "sane_init: config file line %d: missing quotation mark?\n", + linenumber); + continue; + } + errno = 0; local_warmup_time = strtol (word, &end, 0); diff --git a/backend/mustek.c b/backend/mustek.c index 3af0a9188..1af2715cf 100644 --- a/backend/mustek.c +++ b/backend/mustek.c @@ -46,7 +46,7 @@ /**************************************************************************/ /* Mustek backend version */ -#define BUILD 132 +#define BUILD 133 /**************************************************************************/ #include "../include/sane/config.h" @@ -5112,12 +5112,25 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) free (word); word = 0; cp = sanei_config_get_string (cp, &word); + if (!word) + { + DBG (1, "sane_init: config file line %d: missing quotation mark?\n", + linenumber); + continue; + } if (strcmp (word, "strip-height") == 0) { free (word); word = 0; cp = sanei_config_get_string (cp, &word); + if (!word) + { + DBG (1, "sane_init: config file line %d: missing quotation mark?\n", + linenumber); + continue; + } + errno = 0; strip_height = strtod (word, &end); if (end == word) @@ -5264,6 +5277,13 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) free (word); word = 0; cp = sanei_config_get_string (cp, &word); + if (!word) + { + DBG (1, "sane_init: config file line %d: missing quotation mark?\n", + linenumber); + continue; + } + errno = 0; buffer_size = strtol (word, &end, 0); @@ -5311,6 +5331,13 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) free (word); word = 0; cp = sanei_config_get_string (cp, &word); + if (!word) + { + DBG (1, "sane_init: config file line %d: missing quotation mark?\n", + linenumber); + continue; + } + errno = 0; block_size = strtol (word, &end, 0); diff --git a/backend/mustek_usb.c b/backend/mustek_usb.c index afa20023c..5344e6b93 100644 --- a/backend/mustek_usb.c +++ b/backend/mustek_usb.c @@ -46,7 +46,7 @@ This file implements a SANE backend for Mustek 1200UB and similar USB flatbed scanners. */ -#define BUILD 16 +#define BUILD 17 #include "../include/sane/config.h" @@ -764,11 +764,25 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) word = 0; cp = sanei_config_get_string (cp, &word); + if (!word) + { + DBG (1, "sane_init: config file line %d: missing quotation mark?\n", + linenumber); + continue; + } + if (strcmp (word, "max_block_size") == 0) { free (word); word = 0; cp = sanei_config_get_string (cp, &word); + if (!word) + { + DBG (1, "sane_init: config file line %d: missing quotation mark?\n", + linenumber); + continue; + } + errno = 0; max_block_size = strtol (word, &end, 0); if (end == word) diff --git a/backend/test.c b/backend/test.c index 61de5bfe6..b6084b1d8 100644 --- a/backend/test.c +++ b/backend/test.c @@ -41,7 +41,7 @@ This backend is for testing frontends. */ -#define BUILD 21 +#define BUILD 22 #include "../include/sane/config.h" @@ -1088,6 +1088,9 @@ read_option (SANE_String line, SANE_String option_string, cp = sanei_config_get_string (line, &word); + if (!word) + return SANE_STATUS_INVAL; + if (strcmp (word, option_string) != 0) return SANE_STATUS_INVAL; @@ -1101,6 +1104,8 @@ read_option (SANE_String line, SANE_String option_string, case param_bool: { cp = sanei_config_get_string (cp, &word); + if (!word) + return SANE_STATUS_INVAL; if (strlen (word) == 0) { DBG (3, "read_option: option `%s' requires parameter\n", @@ -1126,6 +1131,8 @@ read_option (SANE_String line, SANE_String option_string, SANE_Int int_value; cp = sanei_config_get_string (cp, &word); + if (!word) + return SANE_STATUS_INVAL; errno = 0; int_value = (SANE_Int) strtol (word, &end, 0); if (end == word) @@ -1154,6 +1161,8 @@ read_option (SANE_String line, SANE_String option_string, SANE_Fixed fixed_value; cp = sanei_config_get_string (cp, &word); + if (!word) + return SANE_STATUS_INVAL; errno = 0; double_value = strtod (word, &end); if (end == word) @@ -1180,6 +1189,8 @@ read_option (SANE_String line, SANE_String option_string, case param_string: { cp = sanei_config_get_string (cp, &word); + if (!word) + return SANE_STATUS_INVAL; if (strlen (word) == 0) { DBG (3, "read_option: option `%s' requires parameter\n",