diff options
author | Keith Packard <keithp@keithp.com> | 2014-10-22 14:24:55 -0700 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-10-06 21:16:17 +0200 |
commit | a11629656cc9cfde12f5145191fe05435958d5bd (patch) | |
tree | 06965e821f194002e7b15ca918a2ce273ea52090 /nx-X11 | |
parent | 057cdafdc25c9c82989304ad0427c0038b40c521 (diff) | |
download | nx-libs-a11629656cc9cfde12f5145191fe05435958d5bd.tar.gz nx-libs-a11629656cc9cfde12f5145191fe05435958d5bd.tar.bz2 nx-libs-a11629656cc9cfde12f5145191fe05435958d5bd.zip |
os: Eliminate uninitialized value warnings from access.c
The ConvertAddr function doesn't reliably set the 'addr' return value,
and so callers are getting flagged for using potentially uninitialized
values. Initialize the value in the callers to NULL and then go ahead
and check for NULL values before using them.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
v2: backport to nx-libs 3.6.x (Ulrich Sibiller)
Diffstat (limited to 'nx-X11')
-rw-r--r-- | nx-X11/programs/Xserver/os/access.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c index 1f64366dd..032468362 100644 --- a/nx-X11/programs/Xserver/os/access.c +++ b/nx-X11/programs/Xserver/os/access.c @@ -1171,7 +1171,7 @@ ResetHosts (char *display) struct dn_naddr dnaddr, *dnaddrp, *dnet_addr(); #endif int family = 0; - void *addr; + void *addr = NULL; int len; siTypesInitialize(); @@ -1309,8 +1309,8 @@ ResetHosts (char *display) for (a = addresses ; a != NULL ; a = a->ai_next) { len = a->ai_addrlen; f = ConvertAddr(a->ai_addr,&len,(void **)&addr); - if ( (family == f) || - ((family == FamilyWild) && (f != -1)) ) { + if (addr && ((family == f) || + ((family == FamilyWild) && (f != -1)))) { NewHost(f, addr, len, FALSE); } } @@ -1778,7 +1778,7 @@ InvalidHost ( ClientPtr client) { int family; - void *addr; + void *addr = NULL; register HOST *selfhost, *host; if (!AccessEnabled) /* just let them in */ @@ -1809,11 +1809,11 @@ InvalidHost ( for (host = validhosts; host; host = host->next) { if ((host->family == FamilyServerInterpreted)) { - if (siAddrMatch (family, addr, len, host, client)) { + if (addr && siAddrMatch (family, addr, len, host, client)) { return (0); } } else { - if (addrEqual (family, addr, len, host)) + if (addr && addrEqual (family, addr, len, host)) return (0); } @@ -2085,7 +2085,7 @@ siHostnameAddrMatch(int family, void * addr, int len, struct addrinfo *addresses; struct addrinfo *a; int f, hostaddrlen; - void * hostaddr; + void * hostaddr = NULL; if (siAddrLen >= sizeof(hostname)) return FALSE; @@ -2097,7 +2097,7 @@ siHostnameAddrMatch(int family, void * addr, int len, for (a = addresses ; a != NULL ; a = a->ai_next) { hostaddrlen = a->ai_addrlen; f = ConvertAddr(a->ai_addr,&hostaddrlen,&hostaddr); - if ((f == family) && (len == hostaddrlen) && + if ((f == family) && (len == hostaddrlen) && hostaddr && (acmp (addr, hostaddr, len) == 0) ) { res = TRUE; break; |