diff options
| author | 2026-05-22 19:20:51 +0200 | |
|---|---|---|
| committer | 2026-05-22 19:20:51 +0200 | |
| commit | ba82092e43d4769dbc6f0557d58a243f93542486 (patch) | |
| tree | 4054d7d4b701207f6a7def2799295557c5fdf68d /src/common.h | |
| parent | 9711459dbed7d60bb00c7d2c052623e8489c88e1 (diff) | |
| download | libplist-ba82092e43d4769dbc6f0557d58a243f93542486.tar.gz libplist-ba82092e43d4769dbc6f0557d58a243f93542486.tar.bz2 | |
common: validate PLIST_DATE values before Time64_T conversion
Avoid undefined behavior when serializing malformed PLIST_DATE values
containing NaN, infinity, or values outside the Time64_T range. Add a
shared helper for checked date conversion and use it across writer paths.
Diffstat (limited to 'src/common.h')
| -rw-r--r-- | src/common.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h index 7e5aff7..ffaa78c 100644 --- a/src/common.h +++ b/src/common.h | |||
| @@ -22,11 +22,13 @@ | |||
| 22 | #define COMMON_H | 22 | #define COMMON_H |
| 23 | 23 | ||
| 24 | #include <stddef.h> | 24 | #include <stddef.h> |
| 25 | #include "time64.h" | ||
| 25 | 26 | ||
| 26 | #define MAC_EPOCH 978307200 | 27 | #define MAC_EPOCH 978307200 |
| 27 | 28 | ||
| 28 | size_t dtostr(char *buf, size_t bufsize, double realval); | 29 | size_t dtostr(char *buf, size_t bufsize, double realval); |
| 29 | int num_digits_i(int64_t i); | 30 | int num_digits_i(int64_t i); |
| 30 | int num_digits_u(uint64_t i); | 31 | int num_digits_u(uint64_t i); |
| 32 | int plist_real_to_time64(double realval, Time64_T *timev); | ||
| 31 | 33 | ||
| 32 | #endif | 34 | #endif |
