]> git.puffer.fish Git - matthieu/frr.git/commit
lib: fix gmtime_assafe potential issues
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Tue, 17 Jan 2023 13:21:39 +0000 (10:21 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Tue, 17 Jan 2023 13:21:39 +0000 (10:21 -0300)
commit0839d0c74269164cdc24184c40eb0c25b83483e3
tree87d741035d1bad7a905e86187822c84416b0dd62
parent2273550f04a8255ea6df76c0aa8952eb85a01a84
lib: fix gmtime_assafe potential issues

Changes:
- Convert `unsigned int` to `time_t` to satisfy time truncation warnings
  even though at this point we had already used the modulus operator.

- Avoid trying to access outside the bounds of the array

  `months` array has a size of 13 elements, but the code inside the loop
  uses `i + 1` to peek on the next month.

Found by Coverity Scan (CID 1519752 and 1519769)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
lib/zlog_5424.c