mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
staging: dgap: fix possible NULL dereference
The return pointer from dgap_getword() is used in strcmp() where it is dereferenced. But dgap_getword() can return NULL. Lets put a check there and return 0 as error. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
60aff4ffba
commit
39be6b8b0c
1 changed files with 2 additions and 0 deletions
|
@ -349,6 +349,8 @@ static int dgap_gettok(char **in)
|
|||
|
||||
if (strstr(dgap_cword, "board")) {
|
||||
w = dgap_getword(in);
|
||||
if (!w)
|
||||
return 0;
|
||||
snprintf(dgap_cword, MAXCWORD, "%s", w);
|
||||
for (t = dgap_brdtype; t->token != 0; t++) {
|
||||
if (!strcmp(w, t->string))
|
||||
|
|
Loading…
Reference in a new issue