aboutsummaryrefslogtreecommitdiff
path: root/instrument-functions.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2023-03-11 09:37:35 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2023-03-11 09:41:59 +0100
commit90af881f5ca707dd3f26b2f39e3c5b2330f4efe0 (patch)
treec5dbe00ae74f7ee89d133981c6f4124ee79de320 /instrument-functions.c
parente1a66ebdde63aa5c85fd0da213407d49bc8fdafd (diff)
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.
Diffstat (limited to 'instrument-functions.c')
-rw-r--r--instrument-functions.c3
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]");