Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixups/v1 #10344

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/detect-http-header.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,13 @@ typedef struct HttpMultiBufHeaderThreadData {
static void *HttpMultiBufHeaderThreadDataInit(void *data)
{
HttpMultiBufHeaderThreadData *td = SCCalloc(1, sizeof(*td));

/* This return value check to satisfy our Cocci malloc checks. */
if (td == NULL) {
SCLogError("failed to allocate %" PRIuMAX " bytes: %s", (uintmax_t)sizeof(*td),
strerror(errno));
return NULL;
}
return td;
}

Expand Down Expand Up @@ -658,10 +665,11 @@ static InspectionBuffer *GetHttp1HeaderData(DetectEngineThreadCtx *det_ctx, cons
size_t size = size1 + size2 + 2;
if (hdr_td->items[i].len < size) {
// Use realloc, as this pointer is not freed until HttpMultiBufHeaderThreadDataFree
hdr_td->items[i].buffer = SCRealloc(hdr_td->items[i].buffer, size);
if (unlikely(hdr_td->items[i].buffer == NULL)) {
void *tmp = SCRealloc(hdr_td->items[i].buffer, size);
if (unlikely(tmp == NULL)) {
return NULL;
}
hdr_td->items[i].buffer = tmp;
}
memcpy(hdr_td->items[i].buffer, bstr_ptr(h->name), size1);
hdr_td->items[i].buffer[size1] = ':';
Expand Down
Loading