From: Mike Frysinger Date: Mon, 29 Aug 2011 14:17:39 -0400 Subject: [U-Boot] [RFC PATCH] net: Check network device driver name In-Reply-To: <4E5B48B2.5070602@monstr.eu> References: <1314363160-18362-1-git-send-email-monstr@monstr.eu> <201108261552.44154.vapier@gentoo.org> <4E5B48B2.5070602@monstr.eu> Message-ID: <201108291417.40098.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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