public inbox for b43-dev@lists.infradead.org
 help / color / mirror / Atom feed
* bcm43xx-fwcutter bug report
@ 2014-04-23 12:53 David Binderman
  2014-04-23 14:21 ` Michael Büsch
  0 siblings, 1 reply; 2+ messages in thread
From: David Binderman @ 2014-04-23 12:53 UTC (permalink / raw)
  To: b43-dev

Hello there,

[fwcutter.c:497]: (error) Dangerous usage of 'shortname' (strncpy doesn't always null-terminate it).

Source code is

??? if (strlen(file->name)> 20) {
??????? strncpy(shortname, file->name, 18);
??????? snprintf(filename, sizeof(filename), "%s..", shortname);
??? } else
??????? strcpy (filename, file->name);

Maybe better code

??? if (strlen(file->name)> 20) {
??????? strncpy(shortname, file->name, 18);
??????? shortname[18] = '\0';
??????? snprintf(filename, sizeof(filename), "%s..", shortname);
??? } else
??????? strcpy (filename, file->name);

Regards

David Binderman

 		 	   		  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-23 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-23 12:53 bcm43xx-fwcutter bug report David Binderman
2014-04-23 14:21 ` Michael Büsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox