Skip to content

Commit

Permalink
tools: hv: Check retrun value of strchr call
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
thozza authored and gregkh committed Jun 3, 2013
1 parent 4d81e30 commit f14e600
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/hv/hv_kvp_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, ";");
}
Expand Down

0 comments on commit f14e600

Please sign in to comment.