Subject: kern/2042: if_ppp.c, ilen used before initialized.
To: None <gnats-bugs@NetBSD.ORG>
From: Simon J. Gerraty <sjg@frodo.dn.itg.telecom.com.au>
List: netbsd-bugs
Date: 02/07/1996 17:53:11
>Number:         2042
>Category:       kern
>Synopsis:       ppp_inproc(): ilen is used in loging before initialized
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb  7 03:20:06 1996
>Last-Modified:
>Originator:     Simon J. Gerraty
>Organization:
Simon J. Gerraty		<sjg@zen.void.oz.au>

#include <disclaimer>		/* imagine something _very_ witty here */
>Release:        NetBSD-current Feb03
>Environment:
	
System: NetBSD hobbit 1.1A sparc
Architecture: sparc

>Description:
	
When if_ppp.c is logging received packets, ilen is used without being 
initialized.

>How-To-Repeat:
	
add kdebug 2 to /etc/ppp/options
>Fix:
	
Index: if_ppp.c
===================================================================
RCS file: /prod/cvsroot/usr.src/sys/net/if_ppp.c,v
retrieving revision 1.1.1.5
diff -c -b -r1.1.1.5 if_ppp.c
*** /tmp/T0a16946       Wed Feb  7 17:48:22 1996
--- if_ppp.c    Wed Feb  7 17:47:04 1996
***************
*** 1083,1088 ****
--- 1083,1092 ----
      ifp->if_ipackets++;
      ifp->if_lastchange = time;
  
+     ilen = 0;
+     for (mp = m; mp != NULL; mp = mp->m_next)
+       ilen += mp->m_len;
+ 
      if (sc->sc_flags & SC_LOG_INPKT) {
        printf("ppp%d: got %d bytes\n", ifp->if_unit, ilen);
        pppdumpm(m);
***************
*** 1145,1154 ****
        }
      }
  #endif
- 
-     ilen = 0;
-     for (mp = m; mp != NULL; mp = mp->m_next)
-       ilen += mp->m_len;
  
  #ifdef VJC
      if (sc->sc_flags & SC_VJ_RESET) {
--- 1149,1154 ----
>Audit-Trail:
>Unformatted: