From 49741bec9c1a5725f175a1a0f4b4e4c0eb6834a9 Mon Sep 17 00:00:00 2001 From: Thomas Osterried Date: Thu, 9 Apr 2009 13:25:14 +0000 Subject: nrconfig.c: call comparison fix. axconfig.c, nrconfig.c and rsconfig.c: assurances against null pointer deferences. --- axconfig.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'axconfig.c') diff --git a/axconfig.c b/axconfig.c index fd48067..572df99 100644 --- a/axconfig.c +++ b/axconfig.c @@ -219,11 +219,11 @@ static int ax25_config_init_port(int fd, int lineno, char *line, const char **if } for (p = ax25_ports; p != NULL; p = p->Next) { - if (strcasecmp(name, p->Name) == 0) { + if (p->Name != NULL && strcasecmp(name, p->Name) == 0) { fprintf(stderr, "axconfig: duplicate port name %s in line %d of axports file\n", name, lineno); return FALSE; } - if (is_same_call(call, p->Call)) { + if (p->Call != NULL && is_same_call(call, p->Call)) { fprintf(stderr, "axconfig: duplicate callsign %s in line %d of axports file\n", call, lineno); return FALSE; } @@ -361,15 +361,13 @@ int ax25_config_load_ports(void) break; devlist = pp; if ((calllist[callcount] = strdup(s)) != NULL) { - if (calllist[callcount]) { - if ((devlist[callcount] = strdup(ifr.ifr_name)) != NULL) { - ++callcount; - calllist[callcount] = NULL; - devlist [callcount] = NULL; - } else { - free((void*)calllist[callcount]); - calllist[callcount] = NULL; - } + if ((devlist[callcount] = strdup(ifr.ifr_name)) != NULL) { + ++callcount; + calllist[callcount] = NULL; + devlist [callcount] = NULL; + } else { + free((void*)calllist[callcount]); + calllist[callcount] = NULL; } } } -- cgit v1.2.3