From: Boris Tonofa Date: Mon, 30 Jun 2025 13:39:47 +0000 (+0300) Subject: detect-bytetest: remove meaningless NULL check on data_offset X-Git-Tag: suricata-8.0.0~9 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=66e7437befe5bff9b7a1d6246b01c8ff76252901;p=thirdparty%2Fsuricata.git 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 --- 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;