From 66e7437befe5bff9b7a1d6246b01c8ff76252901 Mon Sep 17 00:00:00 2001 From: Boris Tonofa Date: Mon, 30 Jun 2025 16:39:47 +0300 Subject: [PATCH] detect-bytetest: remove meaningless NULL check on data_offset The condition data_offset == NULL can never be true: data_offset has already been validated as non-NULL a few lines earlier. The guard seems to have been intended for the offset argument, yet throughout the codebase offset is never passed as NULL. (In the unit tests, offset is NULL, but those tests pass the value parameter as NULL, which causes the function to return before offset is dereferenced.) Remove the pointless check to simplify control flow and silence static-analysis warnings. No functional change. Bug 7767 --- src/detect-bytetest.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/detect-bytetest.c b/src/detect-bytetest.c index 7714e7b0ff..e73b9bdd1b 100644 --- a/src/detect-bytetest.c +++ b/src/detect-bytetest.c @@ -468,12 +468,6 @@ static DetectBytetestData *DetectBytetestParse( memmove(data_offset, str_ptr, end_ptr - str_ptr); data_offset[end_ptr-str_ptr] = '\0'; if (data_offset[0] != '-' && isalpha((unsigned char)data_offset[0])) { - if (data_offset == NULL) { - SCLogError("byte_test supplied with " - "var name for offset. \"offset\" argument supplied to " - "this function has to be non-NULL"); - goto error; - } *offset = SCStrdup(data_offset); if (*offset == NULL) goto error; -- 2.47.2