From nobody Sat Nov 23 21:02:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1730972987; cv=none; d=zohomail.com; s=zohoarc; b=i+LumpwDVCyWk49jqZHh53RZQTOYJ+vxWM6DGqNPOMigxx/nePYJSST0TBgCdYH3Wn9RioHJ6k29QUv6I7BMfJf7tcgFalzPDRC1AgR5j8KISTfWfjITBeWrAo/SZ3Cm6EgZARGNdfAM6ekbce2+s6eqSifgev5DLj9nD3OTMvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730972987; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=k8+sL3/NnUjknDx8O8NturBZXTqKMlru/+CvoMSlw0o=; b=INoc97XCWpx/rEju7RuSjuAj5DfWxfwj9r2LTgpIEogen3t4H+Zl6dyyCvblWJ3fKUJEsgtsZDiTb/jA2RcyBu8IxlUL5LCbMDPh0NGVaoRgFdsG0Dj3rzvy3/7PcENpuQpjZhh3fEIjP3gOCYlSzfVqNothE31xV7fZPCxQGyY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1730972987777638.8062183193273; Thu, 7 Nov 2024 01:49:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8z8G-0005Fs-Tn; Thu, 07 Nov 2024 04:48:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8z8F-0005Fc-0W for qemu-devel@nongnu.org; Thu, 07 Nov 2024 04:48:51 -0500 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8z8D-0003un-7f for qemu-devel@nongnu.org; Thu, 07 Nov 2024 04:48:50 -0500 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3e602a73ba1so488278b6e.2 for ; Thu, 07 Nov 2024 01:48:48 -0800 (PST) Received: from localhost ([157.82.207.107]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-7f41f5bcaadsm980699a12.24.2024.11.07.01.48.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Nov 2024 01:48:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1730972927; x=1731577727; darn=nongnu.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=k8+sL3/NnUjknDx8O8NturBZXTqKMlru/+CvoMSlw0o=; b=a0efUspesCV6MCC1scTY1U0MrDDtfJQX4mVryiG83Cl4JbUEKqBVDei04GkwL8tj/M oi4Pmz/cWj8EtZyZIFwm5ArnhiYxWrojk1XG4TENZ4uMuhor5VstCaYmPpWGy9YOID2M Pvx3Aa339KrKZN13mha+KysIjrXIfS5gohPD6mVd1otO55ImsZQjysI/LVtFnLAwEsns cxKjdgZ8I3AWmdt8hFHMsrq30X9X0e656DBrTevpoUu96BBhuSqZ+DoW9QykZKvXIVDX BqXxTXv8l5aHhwFZ4CyL+c+PcvCY7b0ZJshFynqW+Ec9i/DdZHC6dsG8Ty9BI5aSFCMb 0DAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730972927; x=1731577727; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=k8+sL3/NnUjknDx8O8NturBZXTqKMlru/+CvoMSlw0o=; b=YmQ7/Muh6nn1K9rGW/uO36yJQVBHNzKvCmZm4IAqn1fS1cXMWMj3a4q+Ifd3xnnBLE pTMLOqzko0KzgBtRpeJXbt6dnhf4fZ7B8Mjlect8Oo2ImPkw32Q5JP89JaKE2RbxkcCo 0Oq/f26mORMs4DRBuNrddGlQlaLBDbV8hV+oV4CYPXfcbLN4+82oKTbBql/xQF90s5Nf 0R9GXBaLE0qsQNrAI/Z2WHYUGuryi2c1+g+l2G8QfXTcz86BFQCXBpCQEr89H8W7bsk4 hO1vJ0uQbrWhoq1EDNIbYXtMoipf3KwJwLV2QGhmUil/fzHP9xkp0o81ggykEzNjm23f nRow== X-Gm-Message-State: AOJu0YxeMtRNKMsXYLwPPO7ybb24QvaAuzM9OodxuoT+ELbZ0BUKzb0h m51HM31E0Z68qBjsVZ3d7N8DhrYSJcdm02pUINjWN+zlihn+41iNaPvK6MbVK6w= X-Google-Smtp-Source: AGHT+IERVcXKFct4rwP6ZJ5IRaqE/4n/2Eug+/Zn685tGZHc6GvH2pWHbH/4DQVcN+zK4FOKpXSoqQ== X-Received: by 2002:a05:6808:e88:b0:3e5:cf3b:4fc5 with SMTP id 5614622812f47-3e78fcb7b36mr546436b6e.15.1730972927082; Thu, 07 Nov 2024 01:48:47 -0800 (PST) From: Akihiko Odaki Date: Thu, 07 Nov 2024 18:48:44 +0900 Subject: [PATCH] tap-win32: Ignore keys too long MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241107-win32-v1-1-952d508e2546@daynix.com> X-B4-Tracking: v=1; b=H4sIAPuMLGcC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxNDQwNz3fLMPGMj3SSLNIMUQ9NkS0MjIyWg2oKi1LTMCrA50bG1tQACaFM dVwAAAA== To: Jason Wang , Stefan Weil Cc: qemu-devel@nongnu.org, devel@daynix.com, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::22f; envelope-from=akihiko.odaki@daynix.com; helo=mail-oi1-x22f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1730972990024116600 Registry keys get truncated and trigger -Wformat-truncation. Ignore such truncated keys as they are invalid. Signed-off-by: Akihiko Odaki --- net/tap-win32.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) 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; } =20 - snprintf (unit_string, sizeof(unit_string), "%s\\%s", - ADAPTER_KEY, enum_name); + len =3D snprintf(unit_string, sizeof(unit_string), "%s\\%s", + ADAPTER_KEY, enum_name); + if (len >=3D sizeof(unit_string)) { + ++i; + continue; + } =20 status =3D RegOpenKeyEx( HKEY_LOCAL_MACHINE, @@ -338,10 +342,13 @@ static int get_device_guid( return -1; } =20 - snprintf(connection_string, - sizeof(connection_string), - "%s\\%s\\Connection", - NETWORK_CONNECTIONS_KEY, enum_name); + len =3D snprintf(connection_string, sizeof(connection_string), + "%s\\%s\\Connection", + NETWORK_CONNECTIONS_KEY, enum_name); + if (len >=3D sizeof(connection_string)) { + ++i; + continue; + } =20 status =3D RegOpenKeyEx( HKEY_LOCAL_MACHINE, @@ -617,10 +624,11 @@ static int tap_win32_open(tap_win32_overlapped_t **ph= andle, if (rc) return -1; =20 - snprintf (device_path, sizeof(device_path), "%s%s%s", - USERMODEDEVICEDIR, - device_guid, - TAPSUFFIX); + rc =3D snprintf(device_path, sizeof(device_path), "%s%s%s", + USERMODEDEVICEDIR, device_guid, TAPSUFFIX); + if (rc >=3D sizeof(device_path)) { + return -1; + } =20 handle =3D CreateFile ( device_path, --- base-commit: 7e3b6d8063f245d27eecce5aabe624b5785f2a77 change-id: 20241107-win32-b8f0d15c9122 Best regards, --=20 Akihiko Odaki