From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
"David S. Miller" <davem@davemloft.net>,
linux-hams@vger.kernel.org, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] netrom: check that user string is terminated
Date: Wed, 23 Nov 2011 09:22:16 +0100 [thread overview]
Message-ID: <4ECCAD38.9090309@bfs.de> (raw)
In-Reply-To: <20111123065240.GD6871@elgon.mountain>
Am 23.11.2011 07:52, schrieb Dan Carpenter:
> We do an strcpy() of mnemonic in nr_add_node().
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
> index 915a87b..e126c48 100644
> --- a/net/netrom/nr_route.c
> +++ b/net/netrom/nr_route.c
> @@ -670,6 +670,8 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg)
> case SIOCADDRT:
> if (copy_from_user(&nr_route, arg, sizeof(struct nr_route_struct)))
> return -EFAULT;
> + if (strlen(nr_route.mnemonic) >= sizeof(nr_route.mnemonic))
> + return -EINVAL;
I am not sure that it does what you intends.
mnemonic is an array and a malicious use may fill it upto the last char
causing strlen go beyond. perhaps this may help:
nr_route.mnemonic[sizeof(nr_route.mnemonic)-1]=0;
this of cause makes the if() redundant.
> if ((dev = nr_ax25_dev_get(nr_route.device)) == NULL)
> return -EINVAL;
while you are here:
dev = nr_ax25_dev_get(nr_route.device);
if ( dev == NULL )
return -EINVAL;
> if (nr_route.ndigis < 0 || nr_route.ndigis > AX25_MAX_DIGIS) {
if guess "nr_route.ndigis >= AX25_MAX_DIGIS" is intended ?
hope that helps,
wh
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2011-11-23 8:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 6:52 [patch] netrom: check that user string is terminated Dan Carpenter
2011-11-23 8:22 ` walter harms [this message]
2011-11-23 19:12 ` Ralf Baechle
2011-11-23 19:54 ` Dan Carpenter
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=4ECCAD38.9090309@bfs.de \
--to=wharms@bfs.de \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-hams@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ralf@linux-mips.org \
/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).