lkml.org 
[lkml]   [2008]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Re: WAN: new PPP code for generic HDLC
From
Date
Jan Engelhardt <jengelh@computergmbh.de> writes:

>>+ /* LCP only */
>>+ if (pid == PID_LCP)
>>+ switch (cp->code) {
>>+ case LCP_PROTO_REJ:
>>+ pid = ntohs(*(__be16*)skb->data);
>
> What if skb->data happens to be unaligned (can that even happen?)

It can't if the hdlc header is 32-bit aligned... however, I can now
see the above is buggy, skb->data doesn't point to the protocol
field. Unused code paths :-(

> -static const char *code_names[CP_CODES] = {"0", "ConfReq", "ConfAck",
> +static const char *const code_names[] = {"0", "ConfReq", "ConfAck",
> "ConfNak", "ConfRej", "TermReq",
> "TermAck", "CodeRej", "ProtoRej",
> "EchoReq", "EchoReply", "Discard"};

The explicit sizes are there as a prevention.
Thanks.
--
Krzysztof Halasa


\
 
 \ /
  Last update: 2008-03-12 21:13    [W:0.103 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site