Use the same maximum length for tags given on the command line and
tags entered in the GUI.
This commit is contained in:
parent
50794ce787
commit
bda2fe5eb6
|
@ -328,7 +328,7 @@ AskTagProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
switch (LOWORD (wParam)) {
|
switch (LOWORD (wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
len = GetWindowTextLengthA (GetDlgItem (hwnd, IDC_TAG));
|
len = GetWindowTextLengthA (GetDlgItem (hwnd, IDC_TAG));
|
||||||
if (len <= 20) { /* keep it consistent with IDD_TAG */
|
if (len <= MAXTAGLEN) {
|
||||||
tag = xmalloc (len+1);
|
tag = xmalloc (len+1);
|
||||||
GetDlgItemTextA (hwnd, IDC_TAG, tag, len+1);
|
GetDlgItemTextA (hwnd, IDC_TAG, tag, len+1);
|
||||||
if (!badtagchar (tag)) EndDialog (hwnd, IDOK);
|
if (!badtagchar (tag)) EndDialog (hwnd, IDOK);
|
||||||
|
|
|
@ -598,6 +598,9 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
tag = strtok (NULL, whitespace);
|
tag = strtok (NULL, whitespace);
|
||||||
|
if (strlen (tag) > MAXTAGLEN)
|
||||||
|
report (R_FATAL, "tag is too long (maximum %d characters)",
|
||||||
|
MAXTAGLEN);
|
||||||
cp = badtagchar (tag);
|
cp = badtagchar (tag);
|
||||||
if (cp) {
|
if (cp) {
|
||||||
report (R_ERROR, "invalid char in tag: %c", *cp);
|
report (R_ERROR, "invalid char in tag: %c", *cp);
|
||||||
|
|
|
@ -57,6 +57,7 @@ enum report_type {
|
||||||
R_QUIET
|
R_QUIET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MAXTAGLEN 20
|
||||||
extern char *tag;
|
extern char *tag;
|
||||||
int guiAskTag (void);
|
int guiAskTag (void);
|
||||||
int report (enum report_type t, ...);
|
int report (enum report_type t, ...);
|
||||||
|
|
Loading…
Reference in New Issue