Fix possible NULL pointer dereference in VERIFY_READ

Static analysis flagged this. Fixed by simply checking `oldlenp`
before dereferencing it.
This commit is contained in:
Kevin Svetlitski 2023-05-08 18:18:39 -07:00 committed by Qi Wang
parent 12311fe6c3
commit dc0a184f8d

View File

@ -1816,7 +1816,9 @@ ctl_mtx_assert_held(tsdn_t *tsdn) {
/* Verify that the space provided is enough. */ /* Verify that the space provided is enough. */
#define VERIFY_READ(t) do { \ #define VERIFY_READ(t) do { \
if (oldp == NULL || oldlenp == NULL || *oldlenp != sizeof(t)) { \ if (oldp == NULL || oldlenp == NULL || *oldlenp != sizeof(t)) { \
if (oldlenp != NULL) { \
*oldlenp = 0; \ *oldlenp = 0; \
} \
ret = EINVAL; \ ret = EINVAL; \
goto label_return; \ goto label_return; \
} \ } \