tools: hv: Check retrun value of strchr call
Check return value of strchr call and dereference it only if it is not NULL. Signed-off-by: Tomas Hozza <thozza@redhat.com> Acked-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4d81e30744
commit
f14e600a3b
1 changed files with 3 additions and 1 deletions
|
@ -765,7 +765,9 @@ static void kvp_process_ipconfig_file(char *cmd,
|
|||
break;
|
||||
|
||||
x = strchr(p, '\n');
|
||||
*x = '\0';
|
||||
if (x)
|
||||
*x = '\0';
|
||||
|
||||
strcat(config_buf, p);
|
||||
strcat(config_buf, ";");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue