tech-net archive

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

Re: ip6_output.c function returned value not checked



In article <20131003201804.GA12222%mx.elandsys.com@localhost>,
Loganaden Velvindron  <logan%elandsys.com@localhost> wrote:
>Hi All,
>
>sockopt_get() is called once in ip6_output.c without checking the returned
>value.
>Excerpt:
>
>                       optbuflen = sopt->sopt_size;
>                       optbuf = malloc(optbuflen, M_IP6OPT, M_NOWAIT);
>                       if (optbuf == NULL) {
>                               error = ENOBUFS;
>                               break;
>                       }
>
>                       sockopt_get(sopt, optbuf, optbuflen);
>                       optp = &in6p->in6p_outputopts;
>                       error = ip6_pcbopt(optname, optbuf, optbuflen,
>                           optp, kauth_cred_get(), uproto);
>
>shouldn't the return value be checked in case of errors and optbuf free'd
>before breaking/returning ?

Just committed a fix. You need to set error, otherwise you'll return success.

christos



Home | Main Index | Thread Index | Old Index