Received: from list by lists.gnu.org with archive (Exim 4.71) id 1fwjvK-0005Bn-1W for mharc-grub-devel@gnu.org; Mon, 03 Sep 2018 04:09:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwjvI-0005Bh-MD for grub-devel@gnu.org; Mon, 03 Sep 2018 04:09:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwjvF-0000DH-Iz for grub-devel@gnu.org; Mon, 03 Sep 2018 04:09:24 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:44293) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fwjvF-0000Cx-Cl for grub-devel@gnu.org; Mon, 03 Sep 2018 04:09:21 -0400 Received: from mail-wm0-f69.google.com ([74.125.82.69]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fwjvE-0008BM-18 for grub-devel@gnu.org; Mon, 03 Sep 2018 08:09:20 +0000 Received: by mail-wm0-f69.google.com with SMTP id s18-v6so102801wmh.0 for ; Mon, 03 Sep 2018 01:09:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wz2gF/IdxlVWJ/up9SZ8n/lmsCWJ0I6RG8lpkFjXBDI=; b=nGNJ8fHQ7dStiGjqiKWqTOt9LRL5Db/C4aGmApJdfmxWhjRxeyWWBSBy5Nukux0O8D 36GjfG07SponVCY96U2OqMty+w4ydH5P4FTOre219/YgrUt4QTHEEtlPOFnh2KIJQWD9 x1qfxeheXX5mZy2dM8kUf7/URAbY0NT1O/ZuOEvHol7TE25M6PbE0mRmeR4cocLie9E4 KCr4nDCP13iVovrl29HJbp0ZuzO0OCpTnG47fNT7FK+CP8Hw6poFA5WCyumcqV6D/djW ONBapkVsDKobT6NjaPAdy9ft0+W1Hv/WWA7za2U0+V5BQHm9LiEJvnk5lYQuoBYm/Unz nGgw== X-Gm-Message-State: APzg51CTSvTefPEElplyDcZuS7NeZxylTiLHrlK1g3uxXlDuUtj+q6dl xllvtQ/bJCpvb9Z+YYWOt9HvpZiL8KHQk1MQUXfI5FoQJjDsfIhCkz8CPVaJexA4zqexKeb30Uu e4zb85vOJKnOPcW8Lm6NrGuu8O/Pq X-Received: by 2002:adf:db11:: with SMTP id s17-v6mr19184884wri.221.1535962159479; Mon, 03 Sep 2018 01:09:19 -0700 (PDT) X-Google-Smtp-Source: ANB0VdawShqKJgCWqe+9NK7x+lVFC5xGwN8u8pydBsTugKOFnRvxCe+r2wVqpP9dFw9CPUuT1PU4IQ== X-Received: by 2002:adf:db11:: with SMTP id s17-v6mr19184868wri.221.1535962159273; Mon, 03 Sep 2018 01:09:19 -0700 (PDT) Received: from localhost.localdomain ([2a02:908:2814:ce60:6035:a3b4:7053:43e0]) by smtp.gmail.com with ESMTPSA id o6-v6sm8507487wmc.15.2018.09.03.01.09.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 01:09:18 -0700 (PDT) From: Julian Andres Klode To: grub-devel@gnu.org Cc: Julian Andres Klode Subject: [PATCH v2] ofnet: Initialize structs in bootpath parser Date: Mon, 3 Sep 2018 10:09:15 +0200 Message-Id: <20180903080915.20534-1-julian.klode@canonical.com> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 91.189.89.112 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 08:09:25 -0000 Code later on checks if variables inside the struct are 0 to see if they have been set, like if there were addresses in the bootpath. The variables were not initialized however, so the check might succeed with uninitialized data, and a new interface with random addresses and the same name is added. This causes $net_default_mac to point to the random one, so, for example, using that variable to load per-mac config files fails. Bug-Ubuntu: https://bugs.launchpad.net/bugs/1785859 Signed-off-by: Julian Andres Klode --- Notes: v2: Rewrote commit message to address review comments and make it look nicer grub-core/net/drivers/ieee1275/ofnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c index 002446be1..00abc64bb 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -153,8 +153,8 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, char *comma_char = 0; char *equal_char = 0; grub_size_t field_counter = 0; - grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask; - grub_net_link_level_address_t hw_addr; + grub_net_network_level_address_t client_addr = {}, gateway_addr = {}, subnet_mask = {}; + grub_net_link_level_address_t hw_addr = {}; grub_net_interface_flags_t flags = 0; struct grub_net_network_level_interface *inter = NULL; grub_uint16_t vlantag = 0; -- 2.17.1