Skip to content

Commit b8656d7

Browse files
committed
detect-http2: call correct free function on error
While parsing, if a failure occurred the scalar version of the free function was being called instead of the array variant.
1 parent 9d2d1c4 commit b8656d7

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/detect-engine-uint.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ typedef DetectUintData_u32 DetectU32Data;
4242
typedef DetectUintData_u16 DetectU16Data;
4343
typedef DetectUintData_u8 DetectU8Data;
4444

45+
typedef DetectUintArrayData_u8 DetectU8ArrayData;
46+
typedef DetectUintArrayData_u32 DetectU32ArrayData;
47+
4548
int DetectU64Match(const uint64_t parg, const DetectUintData_u64 *du64);
4649
DetectUintData_u64 *DetectU64Parse(const char *u64str);
4750

src/detect-http2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,13 @@ static int DetectHTTP2prioritySetup (DetectEngineCtx *de_ctx, Signature *s, cons
345345
if (SCDetectSignatureSetAppProto(s, ALPROTO_HTTP2) != 0)
346346
return -1;
347347

348-
DetectU8Data *prio = SCDetectU8ArrayParse(str);
348+
DetectU8ArrayData *prio = SCDetectU8ArrayParse(str);
349349
if (prio == NULL)
350350
return -1;
351351

352352
if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_PRIORITY, (SigMatchCtx *)prio,
353353
g_http2_match_buffer_id) == NULL) {
354-
SCDetectU8Free(prio);
354+
SCDetectU8ArrayFree(prio);
355355
return -1;
356356
}
357357

@@ -397,14 +397,14 @@ static int DetectHTTP2windowSetup (DetectEngineCtx *de_ctx, Signature *s, const
397397
if (SCDetectSignatureSetAppProto(s, ALPROTO_HTTP2) != 0)
398398
return -1;
399399

400-
DetectU32Data *wu = SCDetectU32ArrayParse(str);
400+
DetectU32ArrayData *wu = SCDetectU32ArrayParse(str);
401401
if (wu == NULL)
402402
return -1;
403403

404404
// use g_http2_complete_buffer_id as we may have window changes in any state
405405
if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_WINDOW, (SigMatchCtx *)wu,
406406
g_http2_complete_buffer_id) == NULL) {
407-
SCDetectU32Free(wu);
407+
SCDetectU32ArrayFree(wu);
408408
return -1;
409409
}
410410

0 commit comments

Comments
 (0)