From f3b836194c88138cc6f9eb5fe41ff80c6cd4e500 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 8 Oct 2015 23:02:06 +0200 Subject: [PATCH] Pleasing Coverity for the improbable case that a builtin error message length exceeds 4095 bytes. --- libisofs/messages.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libisofs/messages.c b/libisofs/messages.c index 4c9ce39..9675368 100644 --- a/libisofs/messages.c +++ b/libisofs/messages.c @@ -569,7 +569,8 @@ int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...) vsnprintf(msg, MAX_MSG_LEN, fmt, ap); va_end(ap); } else { - strncpy(msg, iso_error_to_msg(errcode), MAX_MSG_LEN); + strncpy(msg, iso_error_to_msg(errcode), MAX_MSG_LEN - 1); + msg[MAX_MSG_LEN - 1] = 0; } libiso_msgs_submit(libiso_msgr, imgid, ISO_ERR_CODE(errcode),