[U-Boot] [RFC PATCH] net: Check network device driver name

Mike Frysinger vapier at gentoo.org
Fri Aug 26 21:52:43 CEST 2011


On Friday, August 26, 2011 08:52:40 Michal Simek wrote:
> If name is longer than allocated space NAMESIZE
> mac address is rewritten which show error
> message like:

since you overflowed the buffer, who knows what could happen ...

> +	if (strlen(dev->name) > NAMESIZE) {
> +		printf("Long(%d>%d) network driver name for %s\n",
> +					strlen(dev->name), NAMESIZE, dev->name);
> +		return 0;
> +	}

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;
}
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110826/44f59aee/attachment.pgp 


More information about the U-Boot mailing list