cifs: writing past end of struct in cifs_convert_address()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 1 Mar 2012 07:06:52 +0000 (10:06 +0300)
committerSteve French <sfrench@us.ibm.com>
Sat, 31 Mar 2012 22:32:18 +0000 (17:32 -0500)
"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 <dan.carpenter@oracle.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/netmisc.c

index dd23a321bdda60b8eacf105bea12b8e2cce51b2f..581c225f7f50b3ae5ac4f4915b6b229c22432fd7 100644 (file)
@@ -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;
        }