diff options
author | Xi Wang <xi.wang@gmail.com> | 2013-02-27 20:05:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:21 -0500 |
commit | df1778be1a33edffa51d094eeda87c858ded6560 (patch) | |
tree | b293cff5791db36641d4c3e802d0c16c77bfe362 /kernel | |
parent | ac2e5327a5e4f6477afc6a3b3b0dc6e0476d71d4 (diff) |
sysctl: fix null checking in bin_dn_node_address()
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sysctl_binary.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c index b25115e8c7f3..ebf72358e86a 100644 --- a/kernel/sysctl_binary.c +++ b/kernel/sysctl_binary.c | |||
@@ -1171,9 +1171,10 @@ static ssize_t bin_dn_node_address(struct file *file, | |||
1171 | 1171 | ||
1172 | /* Convert the decnet address to binary */ | 1172 | /* Convert the decnet address to binary */ |
1173 | result = -EIO; | 1173 | result = -EIO; |
1174 | nodep = strchr(buf, '.') + 1; | 1174 | nodep = strchr(buf, '.'); |
1175 | if (!nodep) | 1175 | if (!nodep) |
1176 | goto out; | 1176 | goto out; |
1177 | ++nodep; | ||
1177 | 1178 | ||
1178 | area = simple_strtoul(buf, NULL, 10); | 1179 | area = simple_strtoul(buf, NULL, 10); |
1179 | node = simple_strtoul(nodep, NULL, 10); | 1180 | node = simple_strtoul(nodep, NULL, 10); |