Use the same maximum length for tags given on the command line and
tags entered in the GUI.
diff --git a/programs/winetest/gui.c b/programs/winetest/gui.c
index b1a5e48..357676d 100644
--- a/programs/winetest/gui.c
+++ b/programs/winetest/gui.c
@@ -328,7 +328,7 @@
switch (LOWORD (wParam)) {
case IDOK:
len = GetWindowTextLengthA (GetDlgItem (hwnd, IDC_TAG));
- if (len <= 20) { /* keep it consistent with IDD_TAG */
+ if (len <= MAXTAGLEN) {
tag = xmalloc (len+1);
GetDlgItemTextA (hwnd, IDC_TAG, tag, len+1);
if (!badtagchar (tag)) EndDialog (hwnd, IDOK);
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index 3d6ea08..05eef4b 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -598,6 +598,9 @@
break;
case 't':
tag = strtok (NULL, whitespace);
+ if (strlen (tag) > MAXTAGLEN)
+ report (R_FATAL, "tag is too long (maximum %d characters)",
+ MAXTAGLEN);
cp = badtagchar (tag);
if (cp) {
report (R_ERROR, "invalid char in tag: %c", *cp);
diff --git a/programs/winetest/winetest.h b/programs/winetest/winetest.h
index dbc1e1c..79fd43e 100644
--- a/programs/winetest/winetest.h
+++ b/programs/winetest/winetest.h
@@ -57,6 +57,7 @@
R_QUIET
};
+#define MAXTAGLEN 20
extern char *tag;
int guiAskTag (void);
int report (enum report_type t, ...);