[En-Nut-Discussion] FIX in pppdebug

Krzysztof Sawicki krzysztof.sawicki at mobile.put.edu.pl
Thu Apr 11 17:16:39 CEST 2013


Hi!

I've got situation where len was written a value like 65532 which 
caused multiple fake option being displayed, so there is the fix:

Index: /home/ksawicki/tmp/nutos-svn/nut/net/pppdebug.c
===================================================================
--- /home/ksawicki/tmp/nutos-svn/nut/net/pppdebug.c	(revision 5087)
+++ /home/ksawicki/tmp/nutos-svn/nut/net/pppdebug.c	(working copy)
@@ -257,8 +257,12 @@
      if ((len = nb->nb_ap.sz) != 0)
          xcpo = nb->nb_ap.vp;
      else {
-        len = nb->nb_dl.sz - ppp_header_sz - sizeof(XCPHDR);
-        xcpo = (XCPOPT *) (((char *) nb->nb_dl.vp) + ppp_header_sz + 
sizeof(XCPHDR));
+    	if ((nb->nb_dl.sz)>(ppp_header_sz + sizeof(XCPHDR)))
+    	{
+            len = nb->nb_dl.sz - ppp_header_sz - sizeof(XCPHDR);
+            xcpo = (XCPOPT *) (((char *) nb->nb_dl.vp) + ppp_header_sz 
+ sizeof(XCPHDR));
+    	}
+    	else len=0;
      }
      fprintf(stream, "[OPT(%u)]", len);
      while (len) {

-- 
Krzysztof Sawicki
Mobile Systems Research Labs, Poznan University of Technology


More information about the En-Nut-Discussion mailing list