From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Bernhard Beschow <shentey@gmail.com>, qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>, Stefan Weil <sw@weilnetz.de>,
qemu-stable@nongnu.org
Subject: Re: [PATCH v2] net/tap-win32: Fix gcc 14 format truncation errors
Date: Wed, 9 Oct 2024 00:40:43 -0300 [thread overview]
Message-ID: <c6faf1d9-5870-4407-9273-f28578ab4b2e@linaro.org> (raw)
In-Reply-To: <20241008202842.4478-1-shentey@gmail.com>
On 8/10/24 17:28, Bernhard Beschow wrote:
> The patch fixes the following errors generated by GCC 14.2:
>
> ../src/net/tap-win32.c:343:19: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 176 [-Werror=format-truncation=]
> 343 | "%s\\%s\\Connection",
> | ^~
> 344 | NETWORK_CONNECTIONS_KEY, enum_name);
> | ~~~~~~~~~
>
> ../src/net/tap-win32.c:341:9: note: 'snprintf' output between 92 and 347 bytes into a destination of size 256
> 341 | snprintf(connection_string,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> 342 | sizeof(connection_string),
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~
> 343 | "%s\\%s\\Connection",
> | ~~~~~~~~~~~~~~~~~~~~~
> 344 | NETWORK_CONNECTIONS_KEY, enum_name);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ../src/net/tap-win32.c:242:58: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 178 [-Werror=format-truncation=]
> 242 | snprintf (unit_string, sizeof(unit_string), "%s\\%s",
> | ^~
> 243 | ADAPTER_KEY, enum_name);
> | ~~~~~~~~~
>
> ../src/net/tap-win32.c:242:9: note: 'snprintf' output between 79 and 334 bytes into a destination of size 256
> 242 | snprintf (unit_string, sizeof(unit_string), "%s\\%s",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 243 | ADAPTER_KEY, enum_name);
> | ~~~~~~~~~~~~~~~~~~~~~~~
>
> ../src/net/tap-win32.c:620:52: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 245 [-Werror=format-truncation=]
> 620 | snprintf (device_path, sizeof(device_path), "%s%s%s",
> | ^~
> 621 | USERMODEDEVICEDIR,
> 622 | device_guid,
> | ~~~~~~~~~~~
> ../src/net/tap-win32.c:620:5: note: 'snprintf' output between 16 and 271 bytes into a destination of size 256
> 620 | snprintf (device_path, sizeof(device_path), "%s%s%s",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 621 | USERMODEDEVICEDIR,
> | ~~~~~~~~~~~~~~~~~~
> 622 | device_guid,
> | ~~~~~~~~~~~~
> 623 | TAPSUFFIX);
> | ~~~~~~~~~~
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2607
> Cc: qemu-stable@nongnu.org
>
> --
---
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> This patch was just compile-tested (which fixes my issue). Testing TAP
> networking under Windows apparently requires extra drivers which I don't want to
> install (not my computer). So it would be nice if someone could give this patch
> a test ride. Thanks!
>
> Changes since v1:
> * Use g_autofree and g_strdup_printf() rather than fixed size arrays (Peter)
> ---
> net/tap-win32.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
next prev parent reply other threads:[~2024-10-09 3:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 20:28 [PATCH v2] net/tap-win32: Fix gcc 14 format truncation errors Bernhard Beschow
2024-10-09 3:40 ` Philippe Mathieu-Daudé [this message]
2024-10-09 6:14 ` Michael Tokarev
2024-10-16 18:49 ` Bernhard Beschow
2024-10-23 21:42 ` Pierrick Bouvier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c6faf1d9-5870-4407-9273-f28578ab4b2e@linaro.org \
--to=philmd@linaro.org \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=shentey@gmail.com \
--cc=sw@weilnetz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).