diff --git a/include/net.h b/include/net.h
index 61568f6b319d107e332781f404b9c388ea23229e..c3bfb6378203ee3e48316b872cc8feeec8cad03f 100644
--- a/include/net.h
+++ b/include/net.h
@@ -40,6 +40,11 @@
 
 /* ARP hardware address length */
 #define ARP_HLEN 6
+/*
+ * The size of a MAC address in string form, each digit requires two chars
+ * and five separator characters to form '00:00:00:00:00:00'.
+ */
+#define ARP_HLEN_ASCII (ARP_HLEN * 2) + (ARP_HLEN - 1)
 
 /* IPv4 addresses are always 32 bits in size */
 struct in_addr {
diff --git a/net/eth_common.c b/net/eth_common.c
index 288090155e50bec54604def7b9ea85731c394735..e9d3c66741201f5ccfe321cf1431e3339f1ed18b 100644
--- a/net/eth_common.c
+++ b/net/eth_common.c
@@ -32,7 +32,7 @@ int eth_getenv_enetaddr(const char *name, uchar *enetaddr)
 
 int eth_setenv_enetaddr(const char *name, const uchar *enetaddr)
 {
-	char buf[20];
+	char buf[ARP_HLEN_ASCII + 1];
 
 	sprintf(buf, "%pM", enetaddr);