]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sysctl: fix null checking in bin_dn_node_address()
authorXi Wang <xi.wang@gmail.com>
Thu, 7 Feb 2013 01:31:54 +0000 (12:31 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Feb 2013 05:47:41 +0000 (16:47 +1100)
The null check of `strchr() + 1' is broken, which is always non-null,
leading to OOB read.  Instead, check the result of strchr().

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/sysctl_binary.c

index b669ca1fa1038a418f05713718f5e9874bdc6b7d..8ce70e518fa02ec3e14e33b75dae61663baed682 100644 (file)
@@ -1193,9 +1193,10 @@ static ssize_t bin_dn_node_address(struct file *file,
 
                /* Convert the decnet address to binary */
                result = -EIO;
-               nodep = strchr(buf, '.') + 1;
+               nodep = strchr(buf, '.');
                if (!nodep)
                        goto out;
+               ++nodep;
 
                area = simple_strtoul(buf, NULL, 10);
                node = simple_strtoul(nodep, NULL, 10);