diff --git a/src/lib/openjp2/event.c b/src/lib/openjp2/event.c index 3251849d..aad9d76c 100644 --- a/src/lib/openjp2/event.c +++ b/src/lib/openjp2/event.c @@ -121,16 +121,14 @@ OPJ_BOOL opj_event_msg(opj_event_mgr_t* p_event_mgr, OPJ_INT32 event_type, if ((fmt != 00) && (p_event_mgr != 00)) { va_list arg; - size_t str_length/*, i, j*/; /* UniPG */ char message[OPJ_MSG_SIZE]; memset(message, 0, OPJ_MSG_SIZE); /* initialize the optional parameter list */ va_start(arg, fmt); - /* check the length of the format string */ - str_length = (strlen(fmt) > OPJ_MSG_SIZE) ? OPJ_MSG_SIZE : strlen(fmt); - (void)str_length; /* parse the format string and put the result in 'message' */ - vsnprintf(message, OPJ_MSG_SIZE, fmt, arg); /* UniPG */ + vsnprintf(message, OPJ_MSG_SIZE, fmt, arg); + /* force zero termination for Windows _vsnprintf() of old MSVC */ + message[OPJ_MSG_SIZE - 1] = '\0'; /* deinitialize the optional parameter list */ va_end(arg);