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),