From: Nivedita Singhvi <niv@us.ibm.com>
To: kuznet@ms2.inr.ac.ru, davem@redhat.com
Cc: netdev@oss.sgi.com
Subject: Patch: minor nit in ip_options_compile()
Date: Fri, 21 Mar 2003 19:56:50 -0800 [thread overview]
Message-ID: <200303211956.50921.niv@us.ibm.com> (raw)
In the following else clause, we check for opt->is_data, which
should always be set for this case, and if not, current code will
lead to a null ptr dereference because skb is always null in
this case..
Figured its better to fall down to returning EINVAL..
Look reasonable?
thanks,
Nivedita
--- /usr/src/linux-2.5.65/net/ipv4/ip_options.c Mon Mar 17 13:44:21 2003
+++ /usr/src/linux-2.5.65ref1/net/ipv4/ip_options.c Fri Mar 21 18:16:05 2003
@@ -245,7 +245,7 @@
int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
{
int l;
- unsigned char * iph;
+ unsigned char * iph = NULL;
unsigned char * optptr;
int optlen;
unsigned char * pp_ptr = NULL;
@@ -259,7 +259,9 @@
optptr = iph + sizeof(struct iphdr);
opt->is_data = 0;
} else {
- optptr = opt->is_data ? opt->__data : (unsigned char*)&(skb->nh.iph[1]);
+ /* Only caller here is ip_options_get(), sets up opt, no skb */
+ if ((optptr = opt->__data) == 0)
+ goto error;
iph = optptr - sizeof(struct iphdr);
}
next reply other threads:[~2003-03-22 3:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-22 3:56 Nivedita Singhvi [this message]
2003-03-24 0:02 ` Patch: minor nit in ip_options_compile() kuznet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200303211956.50921.niv@us.ibm.com \
--to=niv@us.ibm.com \
--cc=davem@redhat.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).