Re: off-by-one in DecodeQ931

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

 



Is this latest patch OK?

On Tue, May 3, 2016 at 1:12 AM, Toby DiPasquale <toby@xxxxxxxx> wrote:
> On Mon, Apr 25, 2016 at 11:29 AM, Florian Westphal <fw@xxxxxxxxx> wrote:
>> -> sz (size_t) will underflow here
>>
>> I'd suggest to change the if (sz < 1) to if (sz < 2) to
>> resolve this, the while loop below has to be taken anyway.
>
> Thanks, Florian! Updated patch below:
>
> Signed-off-by: Toby DiPasquale <toby@xxxxxxxx>
>
> diff --git a/net/netfilter/nf_conntrack_h323_asn1.c
> b/net/netfilter/nf_conntrack_h323_asn1.c
> index bcd5ed6..89b2e46 100644
> --- a/net/netfilter/nf_conntrack_h323_asn1.c
> +++ b/net/netfilter/nf_conntrack_h323_asn1.c
> @@ -846,9 +846,10 @@ int DecodeQ931(unsigned char *buf, size_t sz, Q931 *q931)
>         sz -= len;
>
>         /* Message Type */
> -       if (sz < 1)
> +       if (sz < 2)
>                 return H323_ERROR_BOUND;
>         q931->MessageType = *p++;
> +       sz--;
>         PRINT("MessageType = %02X\n", q931->MessageType);
>         if (*p & 0x80) {
>                 p++;



-- 
Toby DiPasquale
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux