Skip to content

Commit b6ee584

Browse files
Check return value of tfw_hpack_exp_hdr
We should check that `tfw_hpack_exp_hdr` return not NULL and return -ENOMEM if allocation fails to prevent null dereference later.
1 parent 19c3ab3 commit b6ee584

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fw/hpack.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Tempesta FW
33
*
4-
* Copyright (C) 2019-2024 Tempesta Technologies, Inc.
4+
* Copyright (C) 2019-2025 Tempesta Technologies, Inc.
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms of the GNU General Public License as published by
@@ -311,11 +311,16 @@ do { \
311311
r = -ENOMEM; \
312312
goto out; \
313313
} \
314-
if (!TFW_STR_EMPTY(&it->hdr)) \
314+
if (!TFW_STR_EMPTY(&it->hdr)) { \
315315
it->next = tfw_hpack_exp_hdr(req->pool, \
316316
length, it); \
317-
else \
317+
if (!it->next) { \
318+
r = -ENOMEM; \
319+
goto out; \
320+
} \
321+
} else { \
318322
BUFFER_HDR_INIT(length, it); \
323+
} \
319324
} \
320325
} while (0)
321326

0 commit comments

Comments
 (0)