diff options
author | Kevin Svetlitski <svetlitski@meta.com> | 2023-05-08 18:18:39 -0700 |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2023-05-09 10:57:09 -0700 |
commit | dc0a184f8d349546af6a051eb87be47715eacff3 (patch) | |
tree | f0b663a4e675f68b3832f36e81c4c72c446cf529 | |
parent | 12311fe6c37720225a3e8b5798e7051d153d29c1 (diff) | |
download | jemalloc-dc0a184f8d349546af6a051eb87be47715eacff3.tar.gz |
Fix possible `NULL` pointer dereference in `VERIFY_READ`
Static analysis flagged this. Fixed by simply checking `oldlenp`
before dereferencing it.
-rw-r--r-- | src/ctl.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; \ } \ |