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
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 @@
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);