Pleasing Coverity for the improbable case that a builtin error message

length exceeds 4095 bytes.
This commit is contained in:
Thomas Schmitt 2015-10-08 23:02:06 +02:00
parent 3a870d23e3
commit f3b836194c

View File

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