ensure null termination

This commit is contained in:
Doug MacEachern 2005-09-23 02:38:49 +00:00
parent 288bd907f2
commit 624f93de8a

View File

@ -61,6 +61,7 @@ static int get_messagefile_dll(const char *app, char *source, char *dllfile)
} }
strncpy(dllfile, buf, MAX_MSG_LENGTH); strncpy(dllfile, buf, MAX_MSG_LENGTH);
dllfile[MAX_MSG_LENGTH] = '\0';
RegCloseKey(hk); RegCloseKey(hk);
@ -100,6 +101,7 @@ static int get_formatted_message(EVENTLOGRECORD *pevlr, char *dllfile,
insert_strs); insert_strs);
strncpy(msg, msgbuf, MAX_MSG_LENGTH); strncpy(msg, msgbuf, MAX_MSG_LENGTH);
msg[MAX_MSG_LENGTH] = '\0';
FreeLibrary(hlib); FreeLibrary(hlib);
LocalFree((HLOCAL)msgbuf); LocalFree((HLOCAL)msgbuf);