Skip to content

Commit

Permalink
cifs: writing past end of struct in cifs_convert_address()
Browse files Browse the repository at this point in the history
"s6->sin6_scope_id" is an int bits but strict_strtoul() writes a long
so this can corrupt memory on 64 bit systems.

Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
Dan Carpenter authored and Steve French committed Mar 31, 2012
1 parent b2a3ad9 commit 2545e07
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/cifs/netmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ cifs_convert_address(struct sockaddr *dst, const char *src, int len)
memcpy(scope_id, pct + 1, slen);
scope_id[slen] = '\0';

rc = strict_strtoul(scope_id, 0,
(unsigned long *)&s6->sin6_scope_id);
rc = kstrtouint(scope_id, 0, &s6->sin6_scope_id);
rc = (rc == 0) ? 1 : 0;
}

Expand Down

0 comments on commit 2545e07

Please sign in to comment.