From b35cbffda989c651f87e52245b36d5b2bda094d5 Mon Sep 17 00:00:00 2001 From: Peter Kirchgessner Date: Mon, 14 Apr 2003 18:20:41 +0000 Subject: [PATCH] check pointer received from sane_control_option() --- backend/hp.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/backend/hp.c b/backend/hp.c index 4ca6f6260..da5c1fd27 100644 --- a/backend/hp.c +++ b/backend/hp.c @@ -43,9 +43,12 @@ HP Scanner Control Language (SCL). */ -static char *hp_backend_version = "1.02"; +static char *hp_backend_version = "1.03"; /* Changes: + V 1.03, 14-Apr-2003, PK (peter@kirchgessner.net) + - check valp in call of sane_control_option() + V 1.02, 02-Feb-2003, PK (peter@kirchgessner.net) - add OS/2-support by Franz Bakan @@ -880,6 +883,29 @@ sane_control_option (SANE_Handle handle, SANE_Int optnum, DBG(10, "sane_control_option called\n"); + status = SANE_STATUS_GOOD; + switch (action) + { + case SANE_ACTION_GET_VALUE: + case SANE_ACTION_SET_VALUE: + if (!valp) + { + DBG (1,"sane_control_option: valp is NULL\n"); + status = SANE_STATUS_INVAL; + } + break; + + case SANE_ACTION_SET_AUTO: + break; + + default: + DBG (1,"sane_control_option: action unknown\n"); + status = SANE_STATUS_INVAL; + break; + } + + if (status != SANE_STATUS_GOOD) return status; + status = sanei_hp_handle_control(h, optnum, action, valp, info); DBG(10, "sane_control_option will finish with %s\n",