]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
test: do not output non ascii character
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 15 Sep 2022 13:26:46 +0000 (15:26 +0200)
committerVictor Julien <vjulien@oisf.net>
Wed, 25 Jan 2023 19:26:32 +0000 (20:26 +0100)
The unit test for content |aa bz| transforms in place the string
str to replace the 2 characters aa by one character 0xaa
Then, when z is not recognized as a valid hexadeicmal character,
the whole modified string is printed out, inclusing the non-ascii
0xaa

Ticket: #5558
(cherry picked from commit b281199e9aa1d2d66ac35d1f53358afca8c44a13)

src/detect-content.c

index 3609c905d7517d5c9c53e07e2eb69914ee8ac7ce..d0c71755fb851958337390f4ec320e2750ff0998 100644 (file)
@@ -165,8 +165,10 @@ int DetectContentDataParse(
                         // SCLogDebug("space as part of binary string");
                     }
                     else if (str[i] != ',') {
-                        SCLogError(SC_ERR_INVALID_SIGNATURE, "Invalid hex code in "
-                                    "content - %s, hex %c. Invalidating signature.", str, str[i]);
+                        SCLogError(SC_ERR_INVALID_SIGNATURE,
+                                "Invalid hex code in "
+                                "content - %s, hex %c. Invalidating signature.",
+                                contentstr, str[i]);
                         goto error;
                     }
                 } else if (escape) {