]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
allocate max size user and password
authorBastian Dehn <hhaalo@arcor.de>
Thu, 18 Jan 2024 21:32:49 +0000 (22:32 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 18 Jan 2024 21:32:49 +0000 (22:32 +0100)
src/kds_s2000w_net.c

index d31b148b6ea96688c7df9942fb8d054fcc314559..f1945a67ec36c756e57f560a25f0d48c2aae7632 100644 (file)
@@ -1,11 +1,15 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <sane/sane.h>
 
 SANE_Status _sane_kds_s2000w_net_init(SANE_Int * version_code, SANE_Auth_Callback authorize)
 {
+       SANE_Char* username = malloc(SANE_MAX_USERNAME_LEN * sizeof(SANE_Char));
+       SANE_Char* password = malloc(SANE_MAX_PASSWORD_LEN * sizeof(SANE_Char));
+
        SANE_String_Const resource = "kds_s2000w_net";
-       SANE_Char* user = "";
-       SANE_Char* pass = "";
+       SANE_Char* user = username;
+       SANE_Char* pass = password;
        
        printf("Hello sane init\n");
        authorize(resource, user, pass);