]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
htp/test: fix test to pass with UBSAN
authorPhilippe Antoine <pantoine@oisf.net>
Fri, 18 Jul 2025 09:00:52 +0000 (11:00 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 4 Aug 2025 15:54:15 +0000 (17:54 +0200)
Ticket: 6934

Avoids a call to memcpy with NULL ptr and 0 length

src/app-layer-htp.c

index 51754e80159d0aadc84104a44b5e1a4fc6cadc9e..86b45f98ca8f9128281c99da47880fe95e39d50b 100644 (file)
@@ -6127,6 +6127,8 @@ static int HTPBodyReassemblyTest01(void)
     BUG_ON(r != 0);
     r = HtpBodyAppendChunk(NULL, &htud.request_body, chunk2, sizeof(chunk2)-1);
     BUG_ON(r != 0);
+    htud.boundary = (uint8_t *)strdup("e5a320f21416a02493a0a6f561b1c494");
+    htud.boundary_len = strlen("e5a320f21416a02493a0a6f561b1c494");
 
     const uint8_t *chunks_buffer = NULL;
     uint32_t chunks_buffer_len = 0;
@@ -6152,6 +6154,7 @@ static int HTPBodyReassemblyTest01(void)
 
     result = 1;
 end:
+    SCFree(htud.boundary);
     return result;
 }