Fixed popup_message().
[nssm.git] / event.cpp
index bd06363..6744da2 100644 (file)
--- a/event.cpp
+++ b/event.cpp
@@ -73,15 +73,15 @@ int popup_message(unsigned int type, unsigned long id, ...) {
 \r
   TCHAR *format = message_string(id);\r
   if (! format) {\r
-    return MessageBox(0, _T("Message %lu was supposed to go here!"), NSSM, MB_OK | MB_ICONEXCLAMATION);\r
+    return MessageBox(0, _T("The message which was supposed to go here is missing!"), NSSM, MB_OK | MB_ICONEXCLAMATION);\r
   }\r
 \r
-  TCHAR blurb[256];\r
+  TCHAR blurb[512];\r
   va_start(arg, id);\r
-  if (_vsntprintf_s(blurb, sizeof(blurb), _TRUNCATE, format, arg) < 0) {\r
+  if (_vsntprintf_s(blurb, _countof(blurb), _TRUNCATE, format, arg) < 0) {\r
     va_end(arg);\r
     LocalFree(format);\r
-    return MessageBox(0, _T("Message %lu was supposed to go here!"), NSSM, MB_OK | MB_ICONEXCLAMATION);\r
+    return MessageBox(0, _T("the message which was supposed to go here is too big!"), NSSM, MB_OK | MB_ICONEXCLAMATION);\r
   }\r
   va_end(arg);\r
 \r