X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fopenjp2%2Fevent.c;h=aad9d76c98d425451e4c69cd3d7375304addaecf;hb=9a6d41d22b1a4f17a376d2f6f208c52c58b8e4b3;hp=3251849da2760fd363e5f8c05e78f0edcee2b074;hpb=28d2eabca79d06378843d1e94fecfb4a5e22178d;p=openjpeg.git 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);