]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1012 in SNORT/snort3 from file_lib_fix to master
authorTom Peters (thopeter) <thopeter@cisco.com>
Tue, 12 Sep 2017 19:58:06 +0000 (15:58 -0400)
committerTom Peters (thopeter) <thopeter@cisco.com>
Tue, 12 Sep 2017 19:58:06 +0000 (15:58 -0400)
Squashed commit of the following:

commit 7ac239558ebe5f37a6e96efa3e5ab01f39bfee7f
Author: Steven Baigal <sbaigal@cisco.com>
Date:   Tue Sep 12 13:35:55 2017 -0400

    refix the fix on valgrind error for null terminator overwritten issue

src/file_api/file_lib.cc

index 00418d820a8ec34cf8db13e7b863f33f439d2c46..2550fee161b65ec5554c155adb465b9407384c31 100644 (file)
@@ -602,11 +602,11 @@ void FileContext::print_file_data(FILE* fp, const uint8_t* data, int len, int ma
     }
     if (pos)
     {
+        str[pos] = 0;
         for (; pos < 17; pos++)
         {
             if (pos == 8)
             {
-                str[pos] = ' ';
                 pos++;
                 fprintf(fp, "%s", "    ");
             }
@@ -615,7 +615,6 @@ void FileContext::print_file_data(FILE* fp, const uint8_t* data, int len, int ma
                 fprintf(fp, "%s", "   ");
             }
         }
-        str[pos] = 0;
         fprintf(fp, "  %s\n", str);
     }
 }