tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Unchecked function return value



In article <20131004062618.GA1506%mx.elandsys.com@localhost>,
Loganaden Velvindron  <logan%elandsys.com@localhost> wrote:
>Hi All,
>
>In ip6_input.c:
>
>in6_setscope() returns 0 on success.
>
>This was checked at other places:
>
>  472         if (in6_setscope(&ip6->ip6_src, m->m_pkthdr.rcvif, NULL) ||
>  473             in6_setscope(&ip6->ip6_dst, m->m_pkthdr.rcvif, NULL)) {
>  474                 IP6_STATINC(IP6_STAT_BADSCOPE);
>  475                 goto bad;
>  476         }
>  477 
>
>Index: src/sys/netinet6/ip6_input.c
>===================================================================
>RCS file: /cvsroot/src/sys/netinet6/ip6_input.c,v
>retrieving revision 1.143
>diff -u -p -r1.143 ip6_input.c
>--- src/sys/netinet6/ip6_input.c       29 Jun 2013 21:06:58 -0000      1.143
>+++ src/sys/netinet6/ip6_input.c       4 Oct 2013 06:19:52 -0000
>@@ -812,7 +812,9 @@ ip6_setdstifaddr(struct mbuf *m, const s
>               struct ip6aux *ip6a;
> 
>               ip6a = (struct ip6aux *)(mtag + 1);
>-              in6_setscope(&ip6a->ip6a_src, ia->ia_ifp, &ip6a->ip6a_scope_id);
>+              if (in6_setscope(&ip6a->ip6a_src, ia->ia_ifp, 
>&ip6a->ip6a_scope_id)) {
>+                      return NULL;
>+              }
>               ip6a->ip6a_src = ia->ia_addr.sin6_addr;
>               ip6a->ip6a_flags = ia->ia6_flags;

Fixed.

christos



Home | Main Index | Thread Index | Old Index