[Snort-devel] [SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI

Russ Combs (rucombs) rucombs at ...3461...
Mon Apr 14 08:40:55 EDT 2014


Bill, thanks for the patch.  We will take a look at is as soon as we finish editing this backlog of packets.

Russ

________________________________
From: Bill Parker [wp02855 at ...2499...]
Sent: Sunday, April 13, 2014 3:27 PM
To: snort-devel at lists.sourceforge.net
Subject: [Snort-devel] [SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI

Hello All,

    In reviewing some code in NetVI, directory 'src', file 'snprintf.c'
I found a rather lengthy switch()/case workup consisting of the following:

                    case '1':
                    case '2':
                    case '3':
                    case '4':
                    case '5':
                    case '6':
                    case '7':
                    case '8':
                    case '9':

Which could be written as:

                    case '1' ... '9':

since ASCII values for '1' thru '9' are in order in the ASCII
table.  The patch file which modifies this is below:

--- snprintf.c.orig     2014-04-10 04:39:57.132977816 -0700
+++ snprintf.c  2014-04-10 04:40:45.194086136 -0700
@@ -174,15 +174,7 @@
                     case '-': ljust = 1; goto nextch;
                     case '0': /* set zero padding if len not set */
                         if(len==0 && !pointflag) zpad = '0';
-                    case '1':
-                    case '2':
-                    case '3':
-                    case '4':
-                    case '5':
-                    case '6':
-                    case '7':
-                    case '8':
-                    case '9':
+                    case '1' ... '9':
                         if(pointflag)
                             maxwidth = maxwidth*10 + ch - '0';
                         else

Would this be of any use in NetVI and/or Snort/DAQ?

Bill Parker (wp02855 at gmail dot com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.snort.org/pipermail/snort-devel/attachments/20140414/49635222/attachment.html>


More information about the Snort-devel mailing list