From dc0a184f8d349546af6a051eb87be47715eacff3 Mon Sep 17 00:00:00 2001 From: Kevin Svetlitski Date: Mon, 8 May 2023 18:18:39 -0700 Subject: Fix possible `NULL` pointer dereference in `VERIFY_READ` Static analysis flagged this. Fixed by simply checking `oldlenp` before dereferencing it. --- src/ctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ctl.c b/src/ctl.c index cfd4ac6e..61511d34 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -1816,7 +1816,9 @@ ctl_mtx_assert_held(tsdn_t *tsdn) { /* Verify that the space provided is enough. */ #define VERIFY_READ(t) do { \ if (oldp == NULL || oldlenp == NULL || *oldlenp != sizeof(t)) { \ - *oldlenp = 0; \ + if (oldlenp != NULL) { \ + *oldlenp = 0; \ + } \ ret = EINVAL; \ goto label_return; \ } \ -- cgit v1.2.1