public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: line6: fix possible overrun
@ 2014-04-26 17:09 Laurent Navet
  2014-04-26 20:47 ` Mateusz Guzik
  0 siblings, 1 reply; 12+ messages in thread
From: Laurent Navet @ 2014-04-26 17:09 UTC (permalink / raw)
  To: gregkh; +Cc: tiwai, devel, linux-kernel, Laurent Navet

The strcpy operation may write past the end of the fixed-size destination
buffer if the source buffer is too large.

Found by coverity scan : CID 144979

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
---
build tested only

 drivers/staging/line6/audio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/line6/audio.c b/drivers/staging/line6/audio.c
index 171d80c..65f5cd4 100644
--- a/drivers/staging/line6/audio.c
+++ b/drivers/staging/line6/audio.c
@@ -32,9 +32,10 @@ int line6_init_audio(struct usb_line6 *line6)
 
 	line6->card = card;
 
-	strcpy(card->id, line6->properties->id);
+	strncpy(card->id, line6->properties->id, (sizeof(card->id)-1));
 	strcpy(card->driver, DRIVER_NAME);
-	strcpy(card->shortname, line6->properties->name);
+	strncpy(card->shortname, line6->properties->name,
+			(sizeof(card->shortname)-1));
 	/* longname is 80 chars - see asound.h */
 	sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
 		dev_name(line6->ifcdev));
-- 
1.9.1


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

end of thread, other threads:[~2014-04-29 17:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-26 17:09 [PATCH] staging: line6: fix possible overrun Laurent Navet
2014-04-26 20:47 ` Mateusz Guzik
2014-04-26 21:36   ` Dan Carpenter
2014-04-26 21:59     ` Mateusz Guzik
2014-04-27 17:39       ` Dan Carpenter
2014-04-27 19:05         ` Laurent Navet
2014-04-27 20:00         ` Mateusz Guzik
2014-04-27 22:44           ` Dan Carpenter
2014-04-29 14:47             ` Takashi Iwai
2014-04-29 15:02               ` Dan Carpenter
2014-04-29 15:26               ` Mateusz Guzik
2014-04-29 17:28                 ` Dan Carpenter

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