[PATCH v3 3/4] tools: hv: Check retrun value of strchr call
KY Srinivasan
kys at microsoft.com
Mon Jun 3 18:21:08 UTC 2013
> -----Original Message-----
> From: Tomas Hozza [mailto:thozza at redhat.com]
> Sent: Wednesday, May 22, 2013 8:55 AM
> To: gregkh at linuxfoundation.org
> Cc: KY Srinivasan; jasowang at redhat.com; Haiyang Zhang;
> devel at linuxdriverproject.org; Tomas Hozza
> Subject: [PATCH v3 3/4] 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 at redhat.com>
Acked-by: K. Y. Srinivasan <kys at microsoft.com>
> ---
> tools/hv/hv_kvp_daemon.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
> index 81cbb6e..5b8f28f 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, ";");
> }
> --
> 1.8.1.4
>
>
More information about the devel
mailing list