Skip to content

Commit f14e600

Browse files
thozzagregkh
authored andcommitted
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>
1 parent 4d81e30 commit f14e600

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tools/hv/hv_kvp_daemon.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,9 @@ static void kvp_process_ipconfig_file(char *cmd,
765765
break;
766766

767767
x = strchr(p, '\n');
768-
*x = '\0';
768+
if (x)
769+
*x = '\0';
770+
769771
strcat(config_buf, p);
770772
strcat(config_buf, ";");
771773
}

0 commit comments

Comments
 (0)