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

Mike Frysinger vapier at gentoo.org
Mon Aug 29 20:17:39 CEST 2011


On Monday, August 29, 2011 04:07:14 Michal Simek wrote:
> Mike Frysinger wrote:
> > 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;
> > 
> > }
> 
> ok. I see it is 15 chars space + terminated characters.
> 
> Mike: Will you propose this patch or should I do it?

since you've got stuff pending here, best for you to do it :)
-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/20110829/1d90dd74/attachment.pgp 


More information about the U-Boot mailing list