]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add null check get devices
authorBastian Dehn <hhaalo@arcor.de>
Fri, 19 Jan 2024 17:39:40 +0000 (18:39 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 19 Jan 2024 17:39:40 +0000 (18:39 +0100)
src/kds_s2000w_net.c

index efc7411449fae2284464d71f66afd530ca27687c..1ebd62173c6e1ec5badc23aec13f6997b812ccf9 100644 (file)
@@ -5,18 +5,18 @@
 SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback authorize)
 {
        if (version_code == NULL) {
-               printf("verson_code pointer is NULL\n");
+               printf("init: verson_code pointer is NULL\n");
                return SANE_STATUS_INVAL;
        }
 
        if (authorize == NULL) {
-               printf("verson_code pointer is NULL\n");
+               printf("init: verson_code pointer is NULL\n");
                return SANE_STATUS_INVAL;
        }
 
        *version_code = SANE_VERSION_CODE(1, 0, 0);
-       printf("version_code %d", version_code);
-       printf("kds_s2000w_net init\n");
+       printf("init: version_code %ui", version_code);
+       printf("init: kds_s2000w_net init\n");
 
        return SANE_STATUS_GOOD;
 }
@@ -29,6 +29,16 @@ void _sane_kds_s2000w_net_exit(void)
 SANE_Status _sane_kds_s2000w_net_get_devices(SANE_String_Const devicename,
        SANE_Handle* handle)
 {
+       if (devicename == NULL) {
+               printf("get devices: devicename is null\n");
+               return SANE_STATUS_INVAL;
+       }
+
+       if (handle == NULL) {
+               printf("get devices: handle is null\n");
+               return SANE_STATUS_INVAL;
+       }
+
        printf("kds_s2000w_net get devices\n");
 
        return SANE_STATUS_GOOD;