Ver código fonte

Fixed buffer length adding a service via the GUI.

The path to the monitored application and the arguments to the
application are both allowed to be sufficiently large to fit in the
maximum allowable registry value size.  The GUI itself, however, was
restricting input fields to 256 characters.
Iain Patterson 13 anos atrás
pai
commit
a4ac5c7f00
2 arquivos alterados com 3 adições e 5 exclusões
  1. 3 3
      gui.cpp
  2. 0 2
      gui.h

+ 3 - 3
gui.cpp

@@ -63,9 +63,9 @@ int install(HWND window) {
   if (! window) return 1;
 
   /* Check parameters in the window */
-  char name[STRING_SIZE];
+  char name[VALUE_LENGTH];
   char exe[EXE_LENGTH];
-  char flags[STRING_SIZE];
+  char flags[VALUE_LENGTH];
 
   /* Get service name */
   if (! GetDlgItemText(window, IDC_NAME, name, sizeof(name))) {
@@ -120,7 +120,7 @@ int remove(HWND window) {
   if (! window) return 1;
 
   /* Check parameters in the window */
-  char name[STRING_SIZE];
+  char name[VALUE_LENGTH];
 
   /* Get service name */
   if (! GetDlgItemText(window, IDC_NAME, name, sizeof(name))) {

+ 0 - 2
gui.h

@@ -6,8 +6,6 @@
 #include <commctrl.h>
 #include "resource.h"
 
-#define STRING_SIZE 256
-
 int nssm_gui(int, char *);
 void centre_window(HWND);
 int install(HWND);