Skip to content

Commit 231fb39

Browse files
author
John Hankinson
committed
Update .for crash without :
1 parent fc0ccd8 commit 231fb39

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

hll.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,21 @@ ret_code HllStartDir(int i, struct asm_tok tokenarray[])
16391639
hll->labels[LTEST] = 0;
16401640
hll->flags = 0;
16411641
hll->cmd = HLL_FOR;
1642+
/* check for 2 ':',if not throw an error */
1643+
p = tokenarray[i].tokpos;
1644+
for (b = 0; *p; p++)
1645+
{
1646+
if (*p == ':') b++;
1647+
if (*p == 39) break;
1648+
}
1649+
if (b < 2) {
1650+
DebugMsg(("HllStartDir .for loop \n"));
1651+
return(EmitError(SYNTAX_ERROR_EX, "Missing ':' before ')'"));
1652+
}
1653+
else if (b > 2) {
1654+
DebugMsg(("HllStartDir .for loop \n"));
1655+
return(EmitError(SYNTAX_ERROR_EX, "Only 2 ':' allowed before ')'"));
1656+
}
16421657
//copy string to the buffer and get read of spaces
16431658
p = tokenarray[i].tokpos;
16441659
for (b = 0; *p; p++)

0 commit comments

Comments
 (0)