]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
tools: hv: Check retrun value of strchr call
authorTomas Hozza <thozza@redhat.com>
Wed, 22 May 2013 12:54:32 +0000 (14:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Jun 2013 21:13:09 +0000 (14:13 -0700)
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>
tools/hv/hv_kvp_daemon.c

index 81cbb6ecce893d81392ca56343b4c825669b8e5f..5b8f28f2aafa1874642f0a54fbd7067e0f872577 100644 (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, ";");
        }