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
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;