Skip to content
Snippets Groups Projects
Select Git revision
  • experimental default protected
  • nrb/airmax-test
  • v2023.2.4-ffs
  • nrb/ar9344-reset-sequence
  • autinerd/experimental-openwrt-24.10
  • v2023.2.3-ffs
  • v2023.2.2-ffs
  • v2023.2-ffs
  • v2023.1-ffs
  • v2022.1.4-ffs
  • feature/addMikrotikwAP
  • v2022.1.3-ffs
  • v2021.1.2-ffs
  • v2022.1.1-ffs
  • master protected
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • v2020.2.3-ffs
  • nrbffs/fastd-remove-delay
  • experimental-2025-05-27
  • experimental-2025-05-27-base
  • experimental-2025-05-18
  • experimental-2025-05-18-base
  • experimental-2025-05-15
  • experimental-2025-05-15-base
  • experimental-2025-05-13
  • experimental-2025-05-13-base
  • experimental-2025-05-08
  • experimental-2025-05-08-base
  • experimental-2025-05-05
  • experimental-2025-05-05-base
  • experimental-2025-05-02
  • experimental-2025-05-02-base
  • experimental-2025-05-01
  • experimental-2025-05-01-base
  • experimental-2025-04-29
  • experimental-2025-04-29-base
  • experimental-2025-04-27
  • experimental-2025-04-27-base
40 results

gluon-crond.c

Blame
    • Jan-Philipp Litza's avatar
      afce06c3
      gluon-cron: Fix endless loop parsing invalid lines · afce06c3
      Jan-Philipp Litza authored
      Using the line
      ```
      * * * * echo "foobar"
      ```
      (notice the missing fifth time field) in a crontab causes gluon-cron
      to enter an endless loop while parsing it, thus it won't even execute
      the other, valid crontabs.
      
      This is caused by the loop in [line 138] where `begin - min`
      substracts the unsigned `min` from the signed `begin`. If now `begin`
      is invalid, `strict_atoi` returns -1 and the loop starts at
      `(-1)-1=MAX_INT` and runs while `i <= MAX_INT` which is always true.
      
      The real culprit lies in [line 134] where exactly this case
      `begin < min` is checked - but because of the signedness, this check doesn't
      work as expected either.
      
      The easiest solution is to make `min` a signed integer instead of an unsigned
      one, as we do not require it to be very large and only pass the constants 0 or
      1 to it.
      
      To avoid other similar problems, this patch makes the input variable `n` a
      signed integer as well.
      afce06c3
      History
      gluon-cron: Fix endless loop parsing invalid lines
      Jan-Philipp Litza authored
      Using the line
      ```
      * * * * echo "foobar"
      ```
      (notice the missing fifth time field) in a crontab causes gluon-cron
      to enter an endless loop while parsing it, thus it won't even execute
      the other, valid crontabs.
      
      This is caused by the loop in [line 138] where `begin - min`
      substracts the unsigned `min` from the signed `begin`. If now `begin`
      is invalid, `strict_atoi` returns -1 and the loop starts at
      `(-1)-1=MAX_INT` and runs while `i <= MAX_INT` which is always true.
      
      The real culprit lies in [line 134] where exactly this case
      `begin < min` is checked - but because of the signedness, this check doesn't
      work as expected either.
      
      The easiest solution is to make `min` a signed integer instead of an unsigned
      one, as we do not require it to be very large and only pass the constants 0 or
      1 to it.
      
      To avoid other similar problems, this patch makes the input variable `n` a
      signed integer as well.