Skip to content

Commit df1778b

Browse files
xiwtorvalds
authored andcommitted
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>
1 parent ac2e532 commit df1778b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/sysctl_binary.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,9 +1171,10 @@ static ssize_t bin_dn_node_address(struct file *file,
11711171

11721172
/* Convert the decnet address to binary */
11731173
result = -EIO;
1174-
nodep = strchr(buf, '.') + 1;
1174+
nodep = strchr(buf, '.');
11751175
if (!nodep)
11761176
goto out;
1177+
++nodep;
11771178

11781179
area = simple_strtoul(buf, NULL, 10);
11791180
node = simple_strtoul(nodep, NULL, 10);

0 commit comments

Comments
 (0)