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

Michal Simek monstr at monstr.eu
Mon Aug 29 10:07:14 CEST 2011


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?

Thanks,
Michal





-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian


More information about the U-Boot mailing list