From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: Jason Wang <jasowang@redhat.com>, Stefan Weil <sw@weilnetz.de>,
qemu-devel@nongnu.org, devel@daynix.com
Subject: Re: [PATCH] tap-win32: Ignore keys too long
Date: Thu, 7 Nov 2024 09:52:37 +0000 [thread overview]
Message-ID: <ZyyN5UySgCv348KC@redhat.com> (raw)
In-Reply-To: <20241107-win32-v1-1-952d508e2546@daynix.com>
On Thu, Nov 07, 2024 at 06:48:44PM +0900, Akihiko Odaki wrote:
> Registry keys get truncated and trigger -Wformat-truncation. Ignore
> such truncated keys as they are invalid.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> net/tap-win32.c | 28 ++++++++++++++++++----------
> 1 file changed, 18 insertions(+), 10 deletions(-)
These problems were already fixed by changing to g_strdup_printf
commit 75fe36b4e8a994cdf9fd6eb601f49e96b1bc791d
Author: Bernhard Beschow <shentey@gmail.com>
Date: Tue Oct 8 22:28:42 2024 +0200
net/tap-win32: Fix gcc 14 format truncation errors
>
> diff --git a/net/tap-win32.c b/net/tap-win32.c
> index 7edbd7163370..4081ba87991f 100644
> --- a/net/tap-win32.c
> +++ b/net/tap-win32.c
> @@ -239,8 +239,12 @@ static int is_tap_win32_dev(const char *guid)
> return FALSE;
> }
>
> - snprintf (unit_string, sizeof(unit_string), "%s\\%s",
> - ADAPTER_KEY, enum_name);
> + len = snprintf(unit_string, sizeof(unit_string), "%s\\%s",
> + ADAPTER_KEY, enum_name);
> + if (len >= sizeof(unit_string)) {
> + ++i;
> + continue;
> + }
>
> status = RegOpenKeyEx(
> HKEY_LOCAL_MACHINE,
> @@ -338,10 +342,13 @@ static int get_device_guid(
> return -1;
> }
>
> - snprintf(connection_string,
> - sizeof(connection_string),
> - "%s\\%s\\Connection",
> - NETWORK_CONNECTIONS_KEY, enum_name);
> + len = snprintf(connection_string, sizeof(connection_string),
> + "%s\\%s\\Connection",
> + NETWORK_CONNECTIONS_KEY, enum_name);
> + if (len >= sizeof(connection_string)) {
> + ++i;
> + continue;
> + }
>
> status = RegOpenKeyEx(
> HKEY_LOCAL_MACHINE,
> @@ -617,10 +624,11 @@ static int tap_win32_open(tap_win32_overlapped_t **phandle,
> if (rc)
> return -1;
>
> - snprintf (device_path, sizeof(device_path), "%s%s%s",
> - USERMODEDEVICEDIR,
> - device_guid,
> - TAPSUFFIX);
> + rc = snprintf(device_path, sizeof(device_path), "%s%s%s",
> + USERMODEDEVICEDIR, device_guid, TAPSUFFIX);
> + if (rc >= sizeof(device_path)) {
> + return -1;
> + }
>
> handle = CreateFile (
> device_path,
>
> ---
> base-commit: 7e3b6d8063f245d27eecce5aabe624b5785f2a77
> change-id: 20241107-win32-b8f0d15c9122
>
> Best regards,
> --
> Akihiko Odaki <akihiko.odaki@daynix.com>
>
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2024-11-07 9:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 9:48 [PATCH] tap-win32: Ignore keys too long Akihiko Odaki
2024-11-07 9:52 ` Daniel P. Berrangé [this message]
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=ZyyN5UySgCv348KC@redhat.com \
--to=berrange@redhat.com \
--cc=akihiko.odaki@daynix.com \
--cc=devel@daynix.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--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).