[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] [patch] make sure some vars are initialized in eterm/src/libscream.c



in ns_wait_for_socket() it is possible to return an uninitialized "ret" if 
socket() returns failure ... so attached patch sets it to -1 at start ... 
side node, shouldnt that tmp_sock > 0 be >= 0 ?  in reality it'll prob never 
be 0, but a value of 0 from socket() is certainly not an error ...

in ns_ren_disp() it may be possible to pass an uninitialized "l" to the 
MALLOC() so attached patch sets it to 0 at start
-mike

Attachment: pgpKkV9exMf7b.pgp
Description: PGP signature

Index: libscream.c
===================================================================
RCS file: /cvs/e/eterm/Eterm/src/libscream.c,v
retrieving revision 1.33
diff -u -p -r1.33 libscream.c
--- libscream.c	19 Sep 2006 21:07:40 -0000	1.33
+++ libscream.c	14 Oct 2006 05:14:36 -0000
@@ -1084,7 +1084,7 @@ ns_attach_lcl(_ns_sess ** sp)
 static int
 ns_wait_for_socket(int port)
 {
-    int tmp_sock, ret;
+    int tmp_sock, ret = -1;
     time_t start_time;
 
     D_ESCREEN(("Waiting for forwarder to begin listening on port %d.\n", port));
@@ -1933,7 +1933,7 @@ int
 ns_ren_disp(_ns_sess * s, int d, char *name)
 {
     char *i = NULL, *n;
-    size_t l;
+    size_t l = 0;
     int ret = NS_FAIL;
 
     if (!s) {