X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=event.cpp;h=32e4acff856e5cd9af29f02d9175c4fd63ba0ddb;hb=fce252d07bdf443e3b283c26a940d3b0f26fd440;hp=995b7affaaf060c24280b262156c86b72f1afe67;hpb=ce9eb5d4646a0e279eae2909a18fccb1197e15fb;p=nssm.git diff --git a/event.cpp b/event.cpp index 995b7af..32e4acf 100644 --- a/event.cpp +++ b/event.cpp @@ -1,6 +1,7 @@ #include "nssm.h" #define NSSM_ERROR_BUFSIZE 65535 +#define NSSM_NUM_EVENT_STRINGS 16 unsigned long tls_index; /* Convert error code to error string - must call LocalFree() on return value */ @@ -34,7 +35,7 @@ void log_event(unsigned short type, unsigned long id, ...) { va_list arg; int count; char *s; - char *strings[6]; + char *strings[NSSM_NUM_EVENT_STRINGS]; /* Open event log */ HANDLE handle = RegisterEventSource(0, TEXT(NSSM)); @@ -43,7 +44,8 @@ void log_event(unsigned short type, unsigned long id, ...) { /* Log it */ count = 0; va_start(arg, id); - while ((s = va_arg(arg, char *))) strings[count++] = s; + while ((s = va_arg(arg, char *)) && count < NSSM_NUM_EVENT_STRINGS - 1) strings[count++] = s; + strings[count] = 0; va_end(arg); ReportEvent(handle, type, 0, id, 0, count, 0, (const char **) strings, 0);