public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: usbip: stub_main.c:  Cleaning up missing null-terminate after strncpy call
@ 2014-06-04 21:39 Rickard Strandqvist
  2014-06-10  6:57 ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Rickard Strandqvist @ 2014-06-04 21:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Valentina Manea
  Cc: Rickard Strandqvist, navin patidar, linux-usb, devel,
	linux-kernel

Added a guaranteed null-terminate after call to strncpy.

This was partly found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/staging/usbip/stub_main.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/usbip/stub_main.c b/drivers/staging/usbip/stub_main.c
index 9c5832a..f1eb6a2 100644
--- a/drivers/staging/usbip/stub_main.c
+++ b/drivers/staging/usbip/stub_main.c
@@ -166,6 +166,7 @@ static ssize_t store_match_busid(struct device_driver *dev, const char *buf,
 		return -EINVAL;
 
 	strncpy(busid, buf + 4, BUSID_SIZE);
+	busid[BUSID_SIZE - 1] = '\0';
 
 	if (!strncmp(buf, "add ", 4)) {
 		if (add_match_busid(busid) < 0)
-- 
1.7.10.4


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

end of thread, other threads:[~2014-06-12 21:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-04 21:39 [PATCH] staging: usbip: stub_main.c: Cleaning up missing null-terminate after strncpy call Rickard Strandqvist
2014-06-10  6:57 ` Dan Carpenter
2014-06-10 20:48   ` Rickard Strandqvist
2014-06-11  5:45     ` Dan Carpenter
2014-06-12 21:09       ` Rickard Strandqvist
2014-06-12 21:39         ` Dan Carpenter

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