detect/alert: guard SCStrdup result before use

SCStrdup result was stored and immediately used without checking for
NULL, which would cause a NULL dereference if allocation fails.
pull/15601/head
Denis Balashov 5 months ago committed by Victor Julien
parent b2cd08bb91
commit 21bcbe14c1

@ -360,6 +360,9 @@ static inline int PacketAlertSetContext(
}
}
current_json->json_string = SCStrdup(det_ctx->json_content[i].json_content);
if (current_json->json_string == NULL) {
return -1;
}
SCLogDebug("json content %u, value '%s' (%p)", (unsigned int)i,
current_json->json_string, s);
}

Loading…
Cancel
Save