[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/11] gnulib/regexec: Fix possible null-dereference
From: |
Robbie Harwood |
Subject: |
[PATCH 03/11] gnulib/regexec: Fix possible null-dereference |
Date: |
Mon, 25 Oct 2021 17:55:36 -0400 |
From: Darren Kenny <darren.kenny@oracle.com>
It appears to be possible that the mctx->state_log field may be NULL,
and the name of this function, clean_state_log_if_needed(), suggests
that it should be checking that it is valid to be cleaned before
assuming that it does.
Fixes: CID 86720
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
lib/regexec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/regexec.c b/lib/regexec.c
index 6aeba3c0b..e48fe5333 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -1675,6 +1675,9 @@ clean_state_log_if_needed (re_match_context_t *mctx, Idx
next_state_log_idx)
{
Idx top = mctx->state_log_top;
+ if (mctx->state_log == NULL)
+ return REG_NOERROR;
+
if ((next_state_log_idx >= mctx->input.bufs_len
&& mctx->input.bufs_len < mctx->input.len)
|| (next_state_log_idx >= mctx->input.valid_len
--
2.33.0
- [PATCH 00/11] Code hygiene fixes from grub, Robbie Harwood, 2021/10/25
- [PATCH 08/11] Fix __argp_fmtstream_point()'s return type and comparisons with it, Robbie Harwood, 2021/10/25
- [PATCH 07/11] Make CFLAGS less painful, Robbie Harwood, 2021/10/25
- [PATCH 02/11] argp-parse.c (__argp_input): Don't crash if pstate is NULL, Robbie Harwood, 2021/10/25
- [PATCH 05/11] Fix width computation, Robbie Harwood, 2021/10/25
- [PATCH 01/11] Fix base64 module to work with grub codebase, Robbie Harwood, 2021/10/25
- [PATCH 06/11] Make gnulib's regcomp not abort(), Robbie Harwood, 2021/10/25
- [PATCH 03/11] gnulib/regexec: Fix possible null-dereference,
Robbie Harwood <=
- [PATCH 11/11] Fixup for -Werror=ignored-qualifiers issues, Robbie Harwood, 2021/10/25
- [PATCH 04/11] gnulib/regexec: Resolve unused variable, Robbie Harwood, 2021/10/25
- [PATCH 09/11] Fix up a bunch of "gcc -Werror=sign-compare" complaints, Robbie Harwood, 2021/10/25
- [PATCH 10/11] Paper over a stringop-overflow warning about wide char handling, Robbie Harwood, 2021/10/25