[Snort-devel] Patch for plugbase.c::ascii()

Sandro Poppi spoppi at ...224...
Wed Mar 30 12:15:58 EST 2005


Hi Marty,

Attached you'll find a small patch for plugbase.c::ascii() which fixes 
an issue when generating ascii strings for the three characters ><&.

The original version falsely overwrites the first 4 or 5 characters of 
the string.

Happy snort'ing,
Sandro

--- src/plugbase.c.org  2005-03-30 21:57:47.000000000 +0200
+++ src/plugbase.c      2005-03-30 21:59:31.000000000 +0200
@@ -1326,17 +1326,17 @@
           {
               if(xdata[i] == '<')
               {
-                 strncpy(ret_val, "<", size - (d_ptr - ret_val));
+                 strncpy(d_ptr, "<", size - (d_ptr - ret_val));
                   d_ptr+=4;
               }
               else if(xdata[i] == '&')
               {
-                 strncpy(ret_val, "&", size - (d_ptr - ret_val));
+                 strncpy(d_ptr, "&", size - (d_ptr - ret_val));
                   d_ptr += 5;
               }
               else if(xdata[i] == '>')
               {
-                 strncpy(ret_val, ">", size - (d_ptr - ret_val));
+                 strncpy(d_ptr, ">", size - (d_ptr - ret_val));
                   d_ptr += 4;
               }
               else





More information about the Snort-devel mailing list