From nobody Sat Nov 23 22:48:14 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1728296051; cv=none; d=zohomail.com; s=zohoarc; b=nYNKllz2e5Y4xPRH4JIINPAt5p/oMb07+QbnltEWOoGH58NTte8oI59g/6ubmNN1P9Vj2W2M51qkMUiKoe1rUQ6HbK1z9PYrcVWkZHlK+8b03f3xSrQhm923ZpBhx2Wf3VVMaOxMAm0rWOTUOjyLCcOFLvH9qbgpj7XGUtsU0pM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728296051; h=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=g3HU7O9Od7pnMPFWdwD6NFGHc9gsSGNK3QGoebqitF0=; b=DJvE1znyggl/3JSJ/2bs/U+/BLKjPSnC+9UjlykcTQC/osKpyhZGAagRMcSzRtPf9uZ8C19rc3NR7FBE0P3HiNJpoUB7RdJbPn8oyj1O2Ll8qebC5ZAgKOzTXe9Bn9NxJpYt/UsupLU1wgcBT2WXvOTIIyI7NMSz9/+NtQYqNyM= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728296051366766.7940302935469; Mon, 7 Oct 2024 03:14:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxkk8-0005aB-KU; Mon, 07 Oct 2024 06:13:32 -0400 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 1sxkk5-0005Z3-8b for qemu-devel@nongnu.org; Mon, 07 Oct 2024 06:13:30 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sxkk3-0008QK-7f for qemu-devel@nongnu.org; Mon, 07 Oct 2024 06:13:28 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5c718bb04a3so5969832a12.3 for ; Mon, 07 Oct 2024 03:13:26 -0700 (PDT) Received: from archlinux.. ([90.187.110.129]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8e05f3f07sm2995550a12.94.2024.10.07.03.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 03:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728296005; x=1728900805; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=g3HU7O9Od7pnMPFWdwD6NFGHc9gsSGNK3QGoebqitF0=; b=Ooa9pLNdYz1/nPCPqjv9JHkiWY2rEBhJa3LT3kKgUoF9JzkNFdHpWMIagCLz1QmVpR 73bnHmgdSFUjjMCl1etHBjuj63sq+8qY5SjREQwkGUY2qlZqHp534VyWBOHW+no0vj/k h5P42efR3RGxCWzjT4+3HoZMlHCVOsCfyaVfIH3eRJf7MMLry1uVHthNqfalcCyKba7Q d43Fk0vd6vd94d8gyaGxNWY/1MjnNDhXj9sgPac/op24YEbDD6Rv1MeUZWQeXhMMB259 wWntxFWXbJ7hc0my9yGMoxKQBDNAY/iuMNW8ctsz1DpcwBgyJC32cdQ6Ho+rxNbe9VkS JPKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728296005; x=1728900805; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=g3HU7O9Od7pnMPFWdwD6NFGHc9gsSGNK3QGoebqitF0=; b=G50jDuk3YakP3KinzGAKdZBYxOu6QckGR/UiULHBpgGm4aG3tGzFhE4VXIJx9F8GHc X5to6UzsCJtm8jXKf5WDrlqPJCoXgWoPIpGao4z9USZL5xbpaxk/U7E9F+LHI/mafyaB +1n1pQGRgwBsgtkvpxb/0MuPl5oj2Ns6O66Y62VIGlb0IXaW4zvD2Lcdl1nTQ5MZ4ady SzpCstXCQ3+6sBHvliqoBl3EyhmmUbfTVgqoFxm75veTdr+fO25Hfw3QwN1Hi4FSOWt4 EcHxULiw/EDj3oU0LQORqC/EY4Ntol483Vt57PP6wzcgpGTKr0oH6ZIDn3G0AtqYq0yY oNgg== X-Gm-Message-State: AOJu0YysBCLQiE7JFxXjyMUw5dn1LDRn6UPSIcDlKl2p0LSJLkfNenT1 HYTtYpnUVrtp/92loJojT4Lyd/lkCyuvnV2YXkWctqWMjP+GKf5AT/dXmA== X-Google-Smtp-Source: AGHT+IFUX6JEYzvJZCLw6uK8EoUWVQHayMnnqxoyj8nfGlusb+fPf5WtET1FOHnF8jgAQs3TnX5tvg== X-Received: by 2002:a05:6402:35cb:b0:5c9:3fe:c7b9 with SMTP id 4fb4d7f45d1cf-5c903fecb4fmr145284a12.0.1728296004818; Mon, 07 Oct 2024 03:13:24 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jason Wang , Stefan Weil , Bernhard Beschow Subject: [PATCH] net/tap-win32: Fix gcc 14 format truncation errors Date: Mon, 7 Oct 2024 12:13:13 +0200 Message-ID: <20241007101313.3900-1-shentey@gmail.com> X-Mailer: git-send-email 2.46.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: pass client-ip=2a00:1450:4864:20::534; envelope-from=shentey@gmail.com; helo=mail-ed1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @gmail.com) X-ZM-MESSAGEID: 1728296053261116600 Content-Type: text/plain; charset="utf-8" The patch fixes the following errors generated by GCC 14.2: ../src/net/tap-win32.c:343:19: error: '%s' directive output may be truncate= d writing up to 255 bytes into a region of size 176 [-Werror=3Dformat-trunc= ation=3D] 343 | "%s\\%s\\Connection", | ^~ 344 | NETWORK_CONNECTIONS_KEY, enum_name); | ~~~~~~~~~ ../src/net/tap-win32.c:341:9: note: 'snprintf' output between 92 and 347 by= tes 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 truncate= d writing up to 255 bytes into a region of size 178 [-Werror=3Dformat-trunc= ation=3D] 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 by= tes 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 truncate= d writing up to 255 bytes into a region of size 245 [-Werror=3Dformat-trunc= ation=3D] 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 by= tes 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 --- net/tap-win32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/tap-win32.c b/net/tap-win32.c index 7edbd71633..4a4625af2b 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -214,7 +214,7 @@ static int is_tap_win32_dev(const char *guid) =20 for (;;) { char enum_name[256]; - char unit_string[256]; + char unit_string[512]; HKEY unit_key; char component_id_string[] =3D "ComponentId"; char component_id[256]; @@ -315,7 +315,7 @@ static int get_device_guid( while (!stop) { char enum_name[256]; - char connection_string[256]; + char connection_string[512]; HKEY connection_key; char name_data[256]; DWORD name_type; @@ -595,7 +595,7 @@ static void tap_win32_free_buffer(tap_win32_overlapped_= t *overlapped, static int tap_win32_open(tap_win32_overlapped_t **phandle, const char *preferred_name) { - char device_path[256]; + char device_path[512]; char device_guid[0x100]; int rc; HANDLE handle; --=20 2.46.2