mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 03:40:04 +00:00
cifs: fix a possible null pointer deref in decode_ascii_ssetup
When kzalloc fails, we will end up doing NULL pointer derefrence Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com> Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:
parent
2bb93d2441
commit
27b7edcf1c
1 changed files with 4 additions and 3 deletions
|
@ -243,10 +243,11 @@ static void decode_ascii_ssetup(char **pbcc_area, __u16 bleft,
|
||||||
kfree(ses->serverOS);
|
kfree(ses->serverOS);
|
||||||
|
|
||||||
ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
|
ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
|
||||||
if (ses->serverOS)
|
if (ses->serverOS) {
|
||||||
strncpy(ses->serverOS, bcc_ptr, len);
|
strncpy(ses->serverOS, bcc_ptr, len);
|
||||||
if (strncmp(ses->serverOS, "OS/2", 4) == 0)
|
if (strncmp(ses->serverOS, "OS/2", 4) == 0)
|
||||||
cifs_dbg(FYI, "OS/2 server\n");
|
cifs_dbg(FYI, "OS/2 server\n");
|
||||||
|
}
|
||||||
|
|
||||||
bcc_ptr += len + 1;
|
bcc_ptr += len + 1;
|
||||||
bleft -= len + 1;
|
bleft -= len + 1;
|
||||||
|
|
Loading…
Reference in a new issue