All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] message: fusion: mptbase.c:  Cleaning up missing null-terminate after strncpy call
@ 2014-08-09 23:42 Rickard Strandqvist
  0 siblings, 0 replies; only message in thread
From: Rickard Strandqvist @ 2014-08-09 23:42 UTC (permalink / raw)
  To: Nagalakshmi Nandigama, Praveen Krishnamoorthy
  Cc: Rickard Strandqvist, Sreekanth Reddy, Abhijit Mahajan,
	MPT-FusionLinux.pdl, linux-scsi, linux-kernel

Added a guaranteed null-terminate after call to strncpy.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/message/fusion/mptbase.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index ebc0af7..66324f8 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -7706,8 +7706,10 @@ mpt_display_event_info(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply)
 		ds = "Unknown";
 		break;
 	}
-	if (ds)
+	if (ds) {
 		strncpy(evStr, ds, EVENT_DESCR_STR_SZ);
+		evStr[EVENT_DESCR_STR_SZ - 1] = '\0';
+	}
 
 
 	devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-08-09 23:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-09 23:42 [PATCH] message: fusion: mptbase.c: Cleaning up missing null-terminate after strncpy call Rickard Strandqvist

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.