diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-07-30 19:27:01 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-07-30 19:27:01 +0200 |
| commit | 9a6d41d22b1a4f17a376d2f6f208c52c58b8e4b3 (patch) | |
| tree | 8adb445ce02164650b16271c5e8becbf48c7986b /src/lib | |
| parent | b716f8616394252724ca0811eab3a20ab42b2189 (diff) | |
opj_event_msg(): force zero termination of buffer
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/openjp2/event.c | 8 |
1 files changed, 3 insertions, 5 deletions
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); |
