summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/eth.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/eth.c b/net/eth.c
index a34fe59383f..c9b7e85e392 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -224,6 +224,14 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
int eth_register(struct eth_device *dev)
{
struct eth_device *d;
+
+ size_t len = strlen(dev->name);
+ if (len >= NAMESIZE) {
+ printf("Network driver name is too long (%zu >= %zu): %s\n",
+ len, NAMESIZE, dev->name);
+ return -1;
+ }
+
if (!eth_devices) {
eth_current = eth_devices = dev;
eth_current_changed();