[sane-devel] Bug in net.c sane_exit

Henning Meier-Geinitz henning at meier-geinitz.de
Fri Feb 21 15:13:21 GMT 2003


Hi,

On Thu, Feb 20, 2003 at 04:14:51PM -0800, George Garvey wrote:
>    Doesn't set global variables to NULL.

Oops. Thanks for pointing out. This bug may also exist in other
backends.

> Then another sane_init uses invalid pointers when reading the config
> file, and the next sane_exit seg faults.

Right. I'm curious: Which frontend are you using? Most frontends don't
call sane_exit and then sane_init again, as far as I know, that's why
I'm asking.

>    I don't know if the second patch is necessary. Only first_device gave
> me troubles.

devlist may cause trouble too (because of double frees).

Thanks for your patch. Can you try this alternative one (against
current CVS)? I think it's more obvious to initialize in sane_init.

Bye,
  Henning

Index: backend/net.c
===================================================================
RCS file: /cvsroot/external/sane/sane-backends/backend/net.c,v
retrieving revision 1.22
diff -u -u -r1.22 net.c
--- backend/net.c	29 Nov 2002 18:19:51 -0000	1.22
+++ backend/net.c	21 Feb 2003 15:10:56 -0000
@@ -42,7 +42,7 @@
 
 /* Please increase version number with every change
    (don't forget to update net.desc) */
-#define NET_VERSION "1.0.9"
+#define NET_VERSION "1.0.10"
 
 #ifdef _AIX
 # include "../include/lalloca.h" /* MUST come first for AIX! */
@@ -455,6 +455,10 @@
 
   DBG (2, "sane_init: authorize = %p, version_code = %p\n", authorize,
        version_code);
+
+  devlist = 0;
+  first_device = 0;
+  first_handle = 0;
 
   auth_callback = authorize;
 



More information about the sane-devel mailing list