Crash found by Sergey Bronnikov using afl-fuzz.
Based on a diff from and OK by espie@
-/* $OpenBSD: for.c,v 1.46 2015/01/23 13:18:40 espie Exp $ */
+/* $OpenBSD: for.c,v 1.47 2017/12/05 17:47:09 millert Exp $ */
/* $NetBSD: for.c,v 1.4 1996/11/06 17:59:05 christos Exp $ */
/*
Parse_Error(PARSE_FATAL, "Syntax error in for");
return 0;
}
- endVar = ptr++;
- while (ISSPACE(*ptr))
+ endVar = ptr;
+ if (*ptr) {
ptr++;
+ while (ISSPACE(*ptr))
+ ptr++;
+ }
/* End of variable list ? */
if (endVar - wrd == 2 && wrd[0] == 'i' && wrd[1] == 'n')
break;