Skip to content

Commit

Permalink
Fix possible buffer underflow issue in cron parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoslot committed Aug 22, 2024
1 parent 9490f9c commit 5c10a8a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ get_range(bitstr_t *bits, int low, int high, char *names[], int ch, FILE *file)
* Code adapted from set_elements() where this error was probably intended
* to be catched.
*/
if (num1 < low || num1 > high || num2 < low || num2 > high)
if (num1 < low || num1 > high || num2 < low || num2 > high ||
num3 < 0 || num3 > high)
return EOF;

/* range. set all elements from num1 to num2, stepping
Expand Down Expand Up @@ -508,7 +509,7 @@ set_range(bitstr_t *bits, int low, int high, int start, int stop, int step) {
Debug(DPARS|DEXT, ("set_range(?,%d,%d,%d,%d,%d)\n",
low, high, start, stop, step))

if (start < low || stop > high)
if (start < low || stop > high || step <= 0)
return EOF;
start -= low;
stop -= low;
Expand Down

0 comments on commit 5c10a8a

Please sign in to comment.