Bugs item #427099, was updated on 2001-05-24 15:34
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=103152&aid=427099&group_id=3152

Category: Architecture: Server (nsd)
Group: aolserver3_4
Status: Open
Resolution: None
Priority: 5
Submitted By: Adam Zell (zellster)
Assigned to: Nobody/Anonymous (nobody)
Summary: Uninitialized variables

Initial Comment:
There are several instances where variables can be used
before being assigned a value.  Diff follows:

diff -Naur aolserver-3.4/nscp/nscp.c
aolserver-3.4.new/nscp/nscp.c
--- aolserver-3.4/nscp/nscp.c   Tue Dec 12 14:54:27
2000
+++ aolserver-3.4.new/nscp/nscp.c   Thu May 24 15:16:07
2001
@@ -294,6 +294,7 @@
     Ns_ThreadSetName(buf);
     Ns_Log(Notice, "nscp: connect: %s",
ns_inet_ntoa(aPtr->sa.sin_addr));
     if (!Login(aPtr->sock)) {
+   interp = NULL;
    goto done;
     }

Comment: interp is deallocated at the done label, but
will be unassigned if Login fails.  I _think_ NULL is a
safe value, with the caveat that TLS will be created.


diff -Naur aolserver-3.4/nsd/proc.c
aolserver-3.4.new/nsd/proc.c
--- aolserver-3.4/nsd/proc.c    Fri Jan 12 14:51:46
2001
+++ aolserver-3.4.new/nsd/proc.c    Thu May 24 15:19:16
2001
@@ -72,9 +72,9 @@
     if (new) {
        iPtr = ns_malloc(sizeof(Info));
        Tcl_SetHashValue(hPtr, iPtr);
+       iPtr->desc = desc;
+       iPtr->proc = argProc;
     }
-    iPtr->desc = desc;
-    iPtr->proc = argProc;
 }

Comment: iPtr should never be used outside of the if
statement.  Registering the same procedure twice would
cause problems.

diff -Naur aolserver-3.4/nsd/serv.c
aolserver-3.4.new/nsd/serv.c
--- aolserver-3.4/nsd/serv.c    Tue Apr  3 13:21:54
2001
+++ aolserver-3.4.new/nsd/serv.c    Thu May 24 15:21:23
2001
@@ -801,7 +801,7 @@
 {
     Ns_Conn       *conn = (Ns_Conn *) connPtr;
     Ns_DString     ds;
-    int            n, status;
+    int            n, status = NS_ERROR;

     Ns_DStringInit(&ds);

Comment: There are a number of executions paths to the
done label which do not set status.  NS_ERROR should be
a safe default value.



----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=103152&aid=427099&group_id=3152

Reply via email to