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:
Tomas Hozza 2013-05-22 14:54:32 +02:00 committed by Greg Kroah-Hartman
parent 4d81e30744
commit f14e600a3b

View file

@ -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, ";");
}