diff --git a/bindings/java/src/jni/win32/eventlog.c b/bindings/java/src/jni/win32/eventlog.c index 7e13262d..c0f4da8b 100644 --- a/bindings/java/src/jni/win32/eventlog.c +++ b/bindings/java/src/jni/win32/eventlog.c @@ -61,6 +61,7 @@ static int get_messagefile_dll(const char *app, char *source, char *dllfile) } strncpy(dllfile, buf, MAX_MSG_LENGTH); + dllfile[MAX_MSG_LENGTH] = '\0'; RegCloseKey(hk); @@ -100,6 +101,7 @@ static int get_formatted_message(EVENTLOGRECORD *pevlr, char *dllfile, insert_strs); strncpy(msg, msgbuf, MAX_MSG_LENGTH); + msg[MAX_MSG_LENGTH] = '\0'; FreeLibrary(hlib); LocalFree((HLOCAL)msgbuf);