Thread (6 messages) flat view 6 messages, 2 authors, 2017-07-13

Re: [PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

From: David Miller <davem@davemloft.net>
Date: 2017-07-13 20:44:46
Also in: lkml

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 [off-list ref] wrote:
quoted
struct sctp_paramhdr {
        __be16 type;
        __be16 length;
};

typedef struct sctp_errhdr {
        __be16 cause;
        __be16 length;
        __u8  variable[0];
} sctp_errhdr_t;
 ...
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help