]> granicus.if.org Git - neomutt/commit
Prevent null pointer exception for h->ai_canonname 413/head
authorAthanasios Douitsis <aduitsis@gmail.com>
Sat, 18 Feb 2017 21:30:27 +0000 (21:30 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 20 Feb 2017 16:49:41 +0000 (16:49 +0000)
commitdab6a96ebac5ee07a224f602b22267c8f39f4660
tree3d61f27db094cb158f7a35c0152cc1fac48eb452
parent813ef9f259df89105b238f0bf02a17e365bb288e
Prevent null pointer exception for h->ai_canonname

The getaddrinfo call in line 54 sets &h to a struct addrinfo. If a
canonical name cannot be found for the node argument of getaddrinfo,
h->ai_canonname is set to NULL. In that case, the strchr call in line
58 can lead to segfault. This behavior was observed on a macos sierra
while the hostname was 192.168.1.3 (unfortunately this happens quite
often in macos).

The fix is simple, just check h->ai_canonname for the NULL value.
getdomain.c