TMXR: Fix attach TELNET and MESSAGE parsing validation

This commit is contained in:
Mark Pizzolato 2020-08-21 12:14:37 -07:00
parent 407696ccc3
commit 9a73eb9d9d

View file

@ -2874,23 +2874,22 @@ while (*tptr) {
while (cptr && *cptr) { while (cptr && *cptr) {
char *tptr = gbuf + (cptr - gbuf); char *tptr = gbuf + (cptr - gbuf);
get_glyph (cptr, tptr, 0); /* upcase this string */ cptr = get_glyph (cptr, tptr, ';');
if (0 == MATCH_CMD (cptr, "NOTELNET")) if (0 == MATCH_CMD (tptr, "NOTELNET"))
listennotelnet = TRUE; listennotelnet = TRUE;
else else
if (0 == MATCH_CMD (cptr, "TELNET")) if (0 == MATCH_CMD (tptr, "TELNET"))
listennotelnet = FALSE; listennotelnet = FALSE;
else else
if (0 == MATCH_CMD (cptr, "NOMESSAGE")) if (0 == MATCH_CMD (tptr, "NOMESSAGE"))
listennomessage = TRUE; listennomessage = TRUE;
else else
if (0 == MATCH_CMD (cptr, "MESSAGE")) if (0 == MATCH_CMD (tptr, "MESSAGE"))
listennomessage = FALSE; listennomessage = FALSE;
else { else {
if (*tptr) if (*tptr)
return sim_messagef (SCPE_ARG, "Invalid Specifier: %s\n", tptr); return sim_messagef (SCPE_ARG, "Invalid Specifier: %s\n", tptr);
} }
cptr = get_glyph (gbuf, port, ';');
} }
cptr = init_cptr; cptr = init_cptr;
} }
@ -5633,6 +5632,11 @@ SIM_TEST((sim_parse_addr ("localhost:telnet", host, sizeof(host), "localhost", p
SIM_TEST((sim_parse_addr ("telnet", host, sizeof(host), "localhost", port, sizeof(port), "1234", NULL) == -1) || (strcmp(host, "localhost")) || (strcmp(port,"telnet"))); SIM_TEST((sim_parse_addr ("telnet", host, sizeof(host), "localhost", port, sizeof(port), "1234", NULL) == -1) || (strcmp(host, "localhost")) || (strcmp(port,"telnet")));
dptr->dctrl = 0xFFFFFFFF; dptr->dctrl = 0xFFFFFFFF;
dptr->dctrl &= ~TMXR_DBG_TRC; dptr->dctrl &= ~TMXR_DBG_TRC;
sprintf (cmd, "%s -u localhost:65500;telnet;nomessage", dptr->name);
SIM_TEST(attach_cmd (0, cmd));
tmxr = (TMXR *)dptr->units->tmxr;
ln = &tmxr->ldsc[tmxr->lines - 1];
SIM_TEST(detach_cmd (0, dptr->name));
sprintf (cmd, "%s -u localhost:65500;notelnet", dptr->name); sprintf (cmd, "%s -u localhost:65500;notelnet", dptr->name);
SIM_TEST(attach_cmd (0, cmd)); SIM_TEST(attach_cmd (0, cmd));
tmxr = (TMXR *)dptr->units->tmxr; tmxr = (TMXR *)dptr->units->tmxr;