/* Do paranoid checks, then fill in the required variables, and pass back the
pointer to the terminating '}'. */
-if (min > 65535 || max > 65535)
+if (min < 0 || min > 65535 || max < -1 || max > 65535)
*errorptr = ERR5;
else
{
/* This "while" is the end of the "do" above. */
- while (length < MAXLIT && (cd->ctypes[c = *(++ptr)] & ctype_meta) == 0);
+ while (*ptr && length < MAXLIT && (cd->ctypes[c = *(++ptr)] & ctype_meta) == 0);
/* Update the last character and the count of literals */