summaryrefslogtreecommitdiffstats
path: root/src/detect-http-header.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/detect-http-header.c')
-rw-r--r--src/detect-http-header.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/detect-http-header.c b/src/detect-http-header.c
index 2803d05..cd36ea5 100644
--- a/src/detect-http-header.c
+++ b/src/detect-http-header.c
@@ -600,6 +600,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;
}
@@ -668,10 +675,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] = ':';