Date: Sat, 21 Sep 2013 14:22:07 +0000 (UTC) From: Cy Schubert <cy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255761 - head/contrib/ipfilter Message-ID: <201309211422.r8LEM73r053000@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cy Date: Sat Sep 21 14:22:07 2013 New Revision: 255761 URL: http://svnweb.freebsd.org/changeset/base/255761 Log: Check return code from inet_pton. Discovered by: Coverity. Approved by: glebius (mentor) Approved by: re (blanket) Modified: head/contrib/ipfilter/ip_fil.c Modified: head/contrib/ipfilter/ip_fil.c ============================================================================== --- head/contrib/ipfilter/ip_fil.c Sat Sep 21 11:10:09 2013 (r255760) +++ head/contrib/ipfilter/ip_fil.c Sat Sep 21 14:22:07 2013 (r255761) @@ -228,7 +228,19 @@ ipf_setifpaddr(ifp, addr) sin6 = (struct sockaddr_in6 *)&ifa->ifa_addr; sin6->sin6_family = AF_INET6; - inet_pton(AF_INET6, addr, &sin6->sin6_addr); + /* Abort if bad address. */ + switch (inet_pton(AF_INET6, addr, &sin6->sin6_addr)) + { + case 1: + break; + case -1: + perror("inet_pton"); + abort(); + break; + default: + abort(); + break; + } } else #endif {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309211422.r8LEM73r053000>