Bug 137379

Summary: argus-2.0.6-5: local variable used before set
Product: [openSUSE] SUSE LINUX 10.0 Reporter: David Binderman <dcb314>
Component: BasesystemAssignee: Michal Marek <mmarek>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Minor    
Priority: P5 - None    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description David Binderman 2005-12-07 14:46:12 UTC
I just tried to compile package argus-2.0.6-5 with a prerelease of the GNU C
compiler version 4.2. It said

./argus_filter.c:3993: warning: "protoid[4]" is used uninitialized in this function

The source code is

   j =   (pi[3] << 8) + pi[4];

Suggest code rework, around line 4270, function init_protoidarray.

BTW, the email address of the author [argus@sei.cmu.edu ] seems to be broken.
Comment 1 Michal Marek 2006-01-03 13:25:13 UTC
To be honest, I can't figure out what the author ment here, but since
the hash function lookup_protoid() is only called from one place
(init_protoidarray()), it should be OK to do this:

--- common/argus_filter.c
+++ common/argus_filter.c
@@ -4261,6 +4261,7 @@
    protoid[0] = 0;
    protoid[1] = 0;
    protoid[2] = 0;
+   protoid[4] = 0;
 
    for (i = 0; i < ARGUS_MAXEPROTODB; i++) {
       if ((p = argus_eproto_db[i]) != NULL) {


Update: argus_filter.c in the argus-clients package sets the array to
zero as well, so this should be OK.