diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-02-06 16:35:44 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-02-08 11:33:13 +0100 |
commit | 98063d8187d6894f4698d689e7c5a3affbcd1622 (patch) | |
tree | ff8dcf24c0bdcb62666920d4d9717f06fdfaeb88 | |
parent | af5452ba765be92e8bc68f51e4671aa7456856d6 (diff) | |
download | strongswan-98063d8187d6894f4698d689e7c5a3affbcd1622.tar.bz2 strongswan-98063d8187d6894f4698d689e7c5a3affbcd1622.tar.xz |
Don't use a time_t variable with fscanf when parsing uptime
Because "%u" is used as format string in the fscanf call that parses the
uptime and because the length of time_t varies on different platforms
and architectures the value was not written properly if time_t was longer
than an unsigned int and depending on how the target variable was aligned
on the stack. Since there is no conversion specifier to properly parse a
time_t value we use the appropriate integer type instead.
-rw-r--r-- | src/libimcv/os_info/os_info.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libimcv/os_info/os_info.c b/src/libimcv/os_info/os_info.c index 13374c876..2c49cb01d 100644 --- a/src/libimcv/os_info/os_info.c +++ b/src/libimcv/os_info/os_info.c @@ -156,7 +156,7 @@ METHOD(os_info_t, get_uptime, time_t, { const char proc_uptime[] = "/proc/uptime"; FILE *file; - time_t uptime; + u_int uptime; file = fopen(proc_uptime, "r"); if (!file) |