From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Wed, 23 Nov 2011 06:52:40 +0000 Subject: [patch] netrom: check that user string is terminated Message-Id: <20111123065240.GD6871@elgon.mountain> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Ralf Baechle Cc: "David S. Miller" , linux-hams@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org We do an strcpy() of mnemonic in nr_add_node(). Signed-off-by: Dan Carpenter 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; if ((dev = nr_ax25_dev_get(nr_route.device)) = NULL) return -EINVAL; if (nr_route.ndigis < 0 || nr_route.ndigis > AX25_MAX_DIGIS) {