mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
The adjtime() wrapper stored the microsecond offset into the 32-bit `long` timex.offset field without checking for overflow. A large delta (e.g. 400 days) was computed in 64-bit and silently truncated when assigned, wrapping into a small value that passed the ~35 minute range check. adjtime() then returned 0 instead of the expected -1. Compute the offset in int64_t and reject values that do not fit in the timex.offset field with EINVAL. Add a regression test for a multi-day delta. Closes https://github.com/espressif/esp-idf/issues/19051