From f14e600a3bb62905fe9e4e0350048af4ead54ca9 Mon Sep 17 00:00:00 2001 From: Tomas Hozza Date: Wed, 22 May 2013 14:54:32 +0200 Subject: 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 Acked-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- tools/hv/hv_kvp_daemon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 81cbb6ecce89..5b8f28f2aafa 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -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, ";"); } -- cgit v1.2.3-58-ga151