[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH v2 2/2] GCC 7: Allocate sufficient space for sprintf output.



On Tuesday, 14 February 2017 16:51:23 CET Richard W.M. Jones wrote:
> diff --git a/daemon/9p.c b/daemon/9p.c
> index a9e36d1..f72c8dd 100644
> --- a/daemon/9p.c
> +++ b/daemon/9p.c
> @@ -71,9 +71,13 @@ do_list_9p (void)
>      if (d == NULL) break;
>  
>      if (STRPREFIX (d->d_name, "virtio")) {
> -      char mount_tag_path[256];
> -      snprintf (mount_tag_path, sizeof mount_tag_path,
> -                BUS_PATH "/%s/mount_tag", d->d_name);
> +      CLEANUP_FREE char *mount_tag_path;

I'd initialize this (and all the other occurrences in this patch) to
NULL anyway, so if in the future more code is added between the
declaration and the initialization then there's no risk.

LGTM with the above changes.

-- 
Pino Toscano

Attachment: signature.asc
Description: This is a digitally signed message part.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]