[PATCH 1/3] mii-tool: Fix string length

Sascha Hauer s.hauer at pengutronix.de
Wed May 21 05:09:54 PDT 2014


media_list writes into a static string. Worst case length of this string
is 125 bytes, but the function only allocates 100 bytes. Use 256 bytes which
is long enough for some extensions.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 commands/miitool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/miitool.c b/commands/miitool.c
index 1e5d4eb..81b5a25 100644
--- a/commands/miitool.c
+++ b/commands/miitool.c
@@ -61,7 +61,7 @@ const struct {
 
 static const char *media_list(unsigned mask, unsigned mask2, int best)
 {
-	static char buf[100];
+	static char buf[256];
 	int i;
 
 	*buf = '\0';
-- 
2.0.0.rc0




More information about the barebox mailing list