Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1686903
| From | David Miller <davem@davemloft.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}() |
| Date | 2017-07-13 22:50 +0200 |
| Message-ID | <u2TdD-20b-7@gated-at.bofh.it> (permalink) |
| References | <u2QSt-Bw-5@gated-at.bofh.it> <u2RbQ-KY-17@gated-at.bofh.it> <u2RYd-1gM-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Alexander Potapenko <glider@google.com>
Date: Thu, 13 Jul 2017 21:28:39 +0200
> On Thu, Jul 13, 2017 at 8:32 PM, David Miller <davem@davemloft.net> wrote:
>> struct sctp_paramhdr {
>> __be16 type;
>> __be16 length;
>> };
>>
>> typedef struct sctp_errhdr {
>> __be16 cause;
>> __be16 length;
>> __u8 variable[0];
>> } sctp_errhdr_t;
...
>> Something like:
>>
>> pos.v + offsetof(pos.v, length) + sizeof(pos.v->length) <= (void *) chunk + end
>
> Do we need to bother about truncated structures? Shouldn't it be
> enough to check that there's at least sizeof(struct sctp_paramhdr)
> bytes left then?
With the zero length array at the end, it's arguable what the "size"
of such a thing is.
That's why I tried to be explicit with the length field.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}() Alexander Potapenko <glider@google.com> - 2017-07-13 20:20 +0200
Re: [PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}() David Miller <davem@davemloft.net> - 2017-07-13 20:40 +0200
Re: [PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}() Alexander Potapenko <glider@google.com> - 2017-07-13 21:30 +0200
Re: [PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}() David Miller <davem@davemloft.net> - 2017-07-13 22:50 +0200
csiph-web