Commit df1778be authored by Xi Wang's avatar Xi Wang Committed by Linus Torvalds
Browse files

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: default avatarXi Wang <>
Cc: "Eric W. Biederman" <>
Cc: <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent ac2e5327
......@@ -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;
area = simple_strtoul(buf, NULL, 10);
node = simple_strtoul(nodep, NULL, 10);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment