grub2/0177-Fix-grub_net_hwaddr_to_str.patch
Javier Martinez Canillas 1f092caba7
Drop two efinet patches that were causing issues and a bunch of other fixes
Add comments and revert logic changes in 01_fallback_counting
Remove quotes when reading ID value from /etc/os-release
  Related: rhbz#1650706
blscfg: expand grub_users before passing to grub_normal_add_menu_entry()
  Resolves: rhbz#1650706
Drop buggy downstream patch "efinet: retransmit if our device is busy"
  Resolves: rhbz#1649048
Make the menu entry users option argument to be optional
  Related: rhbz#1652434
10_linux_bls: add missing menu entries options
  Resolves: rhbz#1652434
Drop "Be more aggro about actually using the *configured* network device."
  Resolves: rhbz#1654388
Fix menu entry selection based on title
  Resolves: rhbz#1654936

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-12-01 03:28:36 +01:00

42 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Salter <msalter@redhat.com>
Date: Tue, 22 Aug 2017 12:21:12 -0400
Subject: [PATCH] Fix grub_net_hwaddr_to_str
commit 5c3b78c92f8 introduced support for larger network hw addresses.
However, grub_net_hwaddr_to_str() relies on GRUB_NET_MAX_STR_ADDRESS_SIZE
to prevent a spurious ':' at the end of the string. So now, if actual
hwaddr size is less than max, an extra ':' appears at the end of the
string. So calculate max string size based on actual hwaddr length to
fix the problem.
Signed-off-by: Mark Salter <msalter@redhat.com>
---
grub-core/net/net.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index a0f4d00f0be..191e8e41bd6 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -770,6 +770,7 @@ grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str)
{
char *ptr;
unsigned i;
+ int maxstr;
if (addr->len > GRUB_NET_MAX_LINK_ADDRESS_SIZE)
{
@@ -778,9 +779,10 @@ grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str)
addr->type, addr->len);
return;
}
+ maxstr = addr->len * grub_strlen ("XX:");
for (ptr = str, i = 0; i < addr->len; i++)
{
- ptr += grub_snprintf (ptr, GRUB_NET_MAX_STR_HWADDR_LEN - (ptr - str),
+ ptr += grub_snprintf (ptr, maxstr - (ptr - str),
"%02x:", addr->mac[i] & 0xff);
}
}