[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAML0wpFxARgZyrSvbwfk_=VpQZfEmAa0zK8t9w99SNyTUMA3cQ@mail.gmail.com>
Date: Fri, 20 May 2016 20:20:58 -0400
From: Toby DiPasquale <toby@...g.net>
To: Florian Westphal <fw@...len.de>
Cc: pablo@...filter.org, Patrick McHardy <kaber@...sh.net>,
kadlec@...ckhole.kfki.hu, davem@...emloft.net,
netfilter-devel@...r.kernel.org, coreteam@...filter.org,
netdev@...r.kernel.org
Subject: Re: off-by-one in DecodeQ931
I'm a bit new to this; is this patch OK?
On Tue, May 3, 2016 at 1:12 AM, Toby DiPasquale <toby@...g.net> wrote:
> On Mon, Apr 25, 2016 at 11:29 AM, Florian Westphal <fw@...len.de> 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@...g.net>
>
> 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
Powered by blists - more mailing lists