diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2023-03-11 09:47:07 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2023-03-11 09:47:07 +0100 |
commit | 7be9376fdf4fec1d178eca504184d6b030eb73a4 (patch) | |
tree | 367ecd3d794a836bd374006ac3784057e50b3e9c | |
parent | 1b838e1c5b61c37abc712609e64925fcad0bc2a2 (diff) | |
download | tcpdump-7be9376fdf4fec1d178eca504184d6b030eb73a4.tar.gz |
instrument functions: Add a NULL check
Same as in tcpslice to fix a Coverity issue.
The issue was:
Null pointer dereferences (FORWARD_NULL)
Passing null pointer "func" to "strncmp", which dereferences it.
-rw-r--r-- | instrument-functions.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/instrument-functions.c b/instrument-functions.c index aff33ccd..32349772 100644 --- a/instrument-functions.c +++ b/instrument-functions.c @@ -199,7 +199,8 @@ static void print_debug(void *this_fn, void *call_site, action_type action) printf("%s", func); printf(" (%d)", profile_func_level); /* Print the "from" part except for the main function) */ - if (action == ENTER && strncmp(func, "main", sizeof("main"))) { + if (action == ENTER && func != NULL && + strncmp(func, "main", sizeof("main"))) { /* Calling function */ if ((bfd_vma)call_site < vma) { printf("[ERROR address call_site]"); |