Snort mailing list archives

Re: Unicode stdout problem


From: Fyodor <fygrave () tigerteam net>
Date: Thu, 12 Jul 2001 22:56:27 +0700

On Thu, Jul 12, 2001 at 10:12:32AM -0500, Michael Aylor wrote:
Okay, here ya go.  It notifies on "found URI first space" for megs and megs
until it finishes.  I'd prefer to just not see it (unless I've missed the
point of the preprocessor) :)


Accept: 
found URI first space
set URI at 0x80d6704
URI length: 34

Ack.. looks like someone forgot to put debugging messages properly ;p
Patch bellow should fix the problem (also committed to cvs):


Index: spp_unidecode.c
===================================================================
RCS file: /cvsroot/snort/snort/spp_unidecode.c,v
retrieving revision 1.7
diff -u -r1.7 spp_unidecode.c
--- spp_unidecode.c     2001/07/08 05:01:57     1.7
+++ spp_unidecode.c     2001/07/12 15:48:30
@@ -257,9 +257,7 @@
     char *cur;
 
 
-#ifdef DEBUG
-       printf("Decoding\n");
-#endif
+       DebugMessage(DEBUG_DECODE, "Decoding\n");
                        
        out_pos=0;
        i=0;
@@ -281,14 +279,14 @@
         if(*cur == ' ' && !first_space_found)
         {
             first_space_found = 1;
-            printf( "found URI first space\n");
+            DebugMessage(DEBUG_DECODE, "found URI first space\n");
         }
 
         if(first_space_found && *cur != ' ' && !uri_set)
         {
             p->URI.uri = cur;
             uri_set = 1;
-            printf( "set URI at %p\n", p->URI.uri);
+            DebugMessage(DEBUG_DECODE, "set URI at %p\n", p->URI.uri);
         }
 
         if(!uri_finished && uri_set && 
@@ -298,8 +296,8 @@
 
             p->URI.length = (cur - foo);
             uri_finished  = 1;
-            printf( "URI length: %d\n", p->URI.length);
-            printf( "URI: %s\n", p->URI.uri);
+            DebugMessage(DEBUG_DECODE, "URI length: %d\n", p->URI.length);
+            DebugMessage(DEBUG_DECODE, "URI: %s\n", p->URI.uri);
         }
 
                i=i+num_this_char;
@@ -356,9 +354,7 @@
         {
             if (Buff[3]!=0x25)
             {
-#ifdef DEBUG
-                printf("Invalid UTF-8 Code\n");
-#endif
+                DebugMessage(DEBUG_DECODE, "Invalid UTF-8 Code\n");
                 LogInvalid(p);
                 NextChar[0]=Buff[0];
                 return 1;
@@ -371,9 +367,7 @@
 
             if ((Hex2 & 192)!=128)
             {
-#ifdef DEBUG
-                printf("Second Byte Invalid\n");
-#endif
+                DebugMessage(DEBUG_DECODE, "Second Byte Invalid\n");
                 LogInvalid(p);
                 NextChar[0]=Buff[0];
                 return 1;
@@ -386,9 +380,7 @@
 
             if (codes[(Hex * 64) | Hex2]==0)
             {
-#ifdef DEBUG
-                printf("Unknown mapping\n");
-#endif
+                DebugMessage(DEBUG_DECODE, "Unknown mapping\n");
                 LogUnknown(p);
                 NextChar[0]=Buff[0];
                 return 1;
@@ -403,9 +395,7 @@
         {
             if (Buff[3]!=0x25)
             {
-#ifdef DEBUG
-                printf("Invalid UTF-8 Code\n");
-#endif
+                DebugMessage(DEBUG_DECODE, "Invalid UTF-8 Code\n");
                 LogInvalid(p);
                 NextChar[0]=Buff[0];
                 return 1;
@@ -413,9 +403,7 @@
 
             if (Buff[6]!=0x25)
             {
-#ifdef DEBUG
-                printf("Invalid UTF-8 Code\n");
-#endif
+                DebugMessage(DEBUG_DECODE, "Invalid UTF-8 Code\n");
                 LogInvalid(p);
                 NextChar[0]=Buff[0];
                 return 1;
@@ -428,9 +416,7 @@
 
             if ((Hex2 & 192)!=128)
             {
-#ifdef DEBUG
-                printf("Second Byte Invalid\n");
-#endif
+                DebugMessage(DEBUG_DECODE, "Second Byte Invalid\n");
                 LogInvalid(p);
                 NextChar[0]=Buff[0];
                 return 1;
@@ -443,9 +429,7 @@
 
             if ((Hex3 & 192)!=128)
             {
-#ifdef DEBUG
-                printf("Third Byte Invalid\n");
-#endif
+                DebugMessage(DEBUG_DECODE, "Third Byte Invalid\n");
                 LogInvalid(p);
                 NextChar[0]=Buff[0];
                 return 1;
@@ -457,9 +441,7 @@
 
             if ( codes[(Hex * 4096) | (Hex2 * 64) | Hex3] ==0)
             {
-#ifdef DEBUG
-                printf("Unknown Mapping\n");
-#endif
+                DebugMessage(DEBUG_DECODE, "Unknown Mapping\n");
                 LogUnknown(p);
                 NextChar[0]=Buff[0];
                 return 1;


_______________________________________________
Snort-users mailing list
Snort-users () lists sourceforge net
Go to this URL to change user options or unsubscribe:
http://lists.sourceforge.net/lists/listinfo/snort-users
Snort-users list archive:
http://www.geocrawler.com/redir-sf.php3?list=snort-users


Current thread: