diff --git a/ChangeLog b/ChangeLog index d5013449b..e8f068e54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-19 Ilia Sotnikov + * backend/hp5590.c: + Fixed segmentation fault on invalid option passed to + sane_get_option_descriptor(), sane_control_option() + (thanks to Albert Cervera i Areny) + 2008-06-19 Ilia Sotnikov * backend/hp5590.c, backend/hp5590_cmds.c, backend/hp5590_cmds.h * backend/hp5590_low.c, backend/hp5590_low.h diff --git a/backend/hp5590.c b/backend/hp5590.c index a75e7e881..e67a34b6e 100644 --- a/backend/hp5590.c +++ b/backend/hp5590.c @@ -620,6 +620,9 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option) DBG (DBG_proc, "%s, option: %u\n", __FUNCTION__, option); + if (option >= HP5590_OPT_LAST) + return NULL; + return &scanner->opts[option]; } @@ -637,6 +640,9 @@ sane_control_option (SANE_Handle handle, SANE_Int option, if (!handle) return SANE_STATUS_INVAL; + if (option >= HP5590_OPT_LAST) + return SANE_STATUS_INVAL; + if (action == SANE_ACTION_GET_VALUE) { if (option == HP5590_OPT_NUM)