integ/grub/grub2/centos/patches/1002-Don-t-write-trailing-colon-when-populating-MAC-strin.patch
Zhe Hu b5306a34ee rebase grub2 patch to CentOS 7.6 version
Test:
Pass build and simplex deploy test

Depends-On: https://review.openstack.org/627434

Story: 2004522
Task: 28417

Change-Id: Ibd2c0866dc5d7f4475e3da6ad5aeedc284ed5829
Signed-off-by: Zhe Hu <zhe.hu@intel.com>
2018-12-27 12:23:40 +08:00

37 lines
989 B
Diff

From 56561f1b5850888c9266b1155d4ac6d352e791c4 Mon Sep 17 00:00:00 2001
From: root <root@yow-cgts1-lx.wrs.com>
Date: Wed, 28 Mar 2018 11:23:17 -0400
Subject: [PATCH] Don't write trailing colon when populating MAC string
---
grub-core/net/net.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index a6566bd..f3f964e 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -797,11 +797,18 @@ grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str)
return;
}
maxstr = addr->len * grub_strlen ("XX:");
- for (ptr = str, i = 0; i < addr->len; i++)
+ if (addr->len == 0)
+ {
+ return;
+ }
+
+ for (ptr = str, i = 0; i < (addr->len - 1); i++)
{
ptr += grub_snprintf (ptr, maxstr - (ptr - str),
"%02x:", addr->mac[i] & 0xff);
}
+ ptr += grub_snprintf (ptr, maxstr - (ptr - str),
+ "%02x", addr->mac[i] & 0xff);
}
int
--
2.7.4