aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2023-07-18 14:35:41 +0200
committerHarald Welte <laforge@osmocom.org>2023-07-18 14:35:41 +0200
commite36dbcbc03fcc1c70d098a8c2330b2e293b70de3 (patch)
tree164248b88b869f07983b99aa68abb7d0926be082
parent3f2361ee33678636aa2d0698957cdf98595d6a5d (diff)
daemon_vty: avoid null-dereference in argc < 0 case
in show_gtp_cmd, we have two different checks (argc > 0) vs (argc) which means in theory argc could be negative and the second clause would be executed without the first having set up related data such as 'ai'. Fixes: CID#307521: Explicit null dereferenced (FORWARD_NULL) Change-Id: I4149b0b191a34168ba6649338d3cdf6c6af6cfe7
-rw-r--r--daemon/daemon_vty.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/daemon/daemon_vty.c b/daemon/daemon_vty.c
index cfbe421..c5cca74 100644
--- a/daemon/daemon_vty.c
+++ b/daemon/daemon_vty.c
@@ -145,7 +145,7 @@ DEFUN(show_gtp, show_gtp_cmd,
show_ep_hdr(vty);
pthread_rwlock_rdlock(&g_daemon->rwlock);
- if (argc) {
+ if (argc > 0) {
ep = _gtp_endpoint_find(g_daemon, (const struct sockaddr_storage *) ai->ai_addr);
if (!ep) {
pthread_rwlock_unlock(&g_daemon->rwlock);