11c474e8de
Story: 2003389 Task: 24495 Change-Id: Ia5ccf65e9c3e462710694f1e860bf4281339ca85 Signed-off-by: slin14 <shuicheng.lin@intel.com>
37 lines
989 B
Diff
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
|
|
@@ -794,11 +794,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
|
|
|