Skip to content

Commit

Permalink
sysctl: fix null checking in bin_dn_node_address()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
xiw authored and torvalds committed Feb 28, 2013
1 parent ac2e532 commit df1778b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/sysctl_binary.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,9 +1171,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);
Expand Down

0 comments on commit df1778b

Please sign in to comment.