All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alec Brown <alec.r.brown@oracle.com>
To: grub-devel@gnu.org
Cc: daniel.kiper@oracle.com, darren.kenny@oracle.com,
	alec.r.brown@oracle.com
Subject: [PATCH 3/7] grub-core/net/arp.c: Fix uninitialized scalar variable
Date: Tue, 15 Mar 2022 16:24:05 -0400	[thread overview]
Message-ID: <1647375849-24164-4-git-send-email-alec.r.brown@oracle.com> (raw)
In-Reply-To: <1647375849-24164-1-git-send-email-alec.r.brown@oracle.com>

In the function grub_net_arp_receive(), grub_net_network_level_address_t
sender_addr and target_addr are being called but aren't being initialized. To
prevent contents of these structures from being filled with junk data from the
stack, we can initialize them to 0 by setting sender_addr and target_addr to {}.

Fixes: CID 375030

Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
---
 grub-core/net/arp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
index 54306e3b1..2b3765932 100644
--- a/grub-core/net/arp.c
+++ b/grub-core/net/arp.c
@@ -115,7 +115,8 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
                       grub_uint16_t *vlantag)
 {
   struct arppkt *arp_packet = (struct arppkt *) nb->data;
-  grub_net_network_level_address_t sender_addr, target_addr;
+  grub_net_network_level_address_t sender_addr = {};
+  grub_net_network_level_address_t target_addr = {};
   grub_net_link_level_address_t sender_mac_addr;
   struct grub_net_network_level_interface *inf;
 
-- 
2.27.0



  parent reply	other threads:[~2022-03-15 20:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 20:24 [PATCH 0/7] Fix coverity uninitialized scalar variable bugs in grub-core Alec Brown
2022-03-15 20:24 ` [PATCH 1/7] grub-core/loader/i386/bsd.c: Fix uninitialized scalar variable Alec Brown
2022-03-15 20:24 ` [PATCH 2/7] grub-core/loader/i386/pc/linux.c: " Alec Brown
2022-03-15 20:24 ` Alec Brown [this message]
2022-03-15 20:24 ` [PATCH 4/7] grub-core/loader/i386/xnu.c: " Alec Brown
2022-03-15 20:24 ` [PATCH 5/7] grub-core/net/net.c: " Alec Brown
2022-03-16  1:16   ` Glenn Washburn
2022-03-17 21:20     ` Daniel Kiper
2022-03-15 20:24 ` [PATCH 6/7] grub-core/loader/i386/xnu.c: " Alec Brown
2022-03-15 20:24 ` [PATCH 7/7] grub-core/net/bootp.c: " Alec Brown
2022-03-15 20:32 ` [PATCH 0/7] Fix coverity uninitialized scalar variable bugs in grub-core Darren Kenny

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=1647375849-24164-4-git-send-email-alec.r.brown@oracle.com \
    --to=alec.r.brown@oracle.com \
    --cc=daniel.kiper@oracle.com \
    --cc=darren.kenny@oracle.com \
    --cc=grub-devel@gnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.