summaryrefslogtreecommitdiffstats
path: root/src/detect-http-header.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:40:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:40:14 +0000
commit2c370a1dd70130d82e9222945ff2421a4168e640 (patch)
tree670794b3ba895e1a01c834c5b7881d123eb46f38 /src/detect-http-header.c
parentAdding debian version 1:7.0.3-1. (diff)
downloadsuricata-2c370a1dd70130d82e9222945ff2421a4168e640.tar.xz
suricata-2c370a1dd70130d82e9222945ff2421a4168e640.zip
Merging upstream version 1:7.0.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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] = ':';