Added a guaranteed null-terminate after call to strncpy.

Signed-off-by: Rickard Strandqvist <rickard_strandqv...@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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to