utils: Fix %T printf hook on big-endian systems
authorTobias Brunner <tobias@strongswan.org>
Mon, 6 Jan 2014 14:30:02 +0000 (15:30 +0100)
committerTobias Brunner <tobias@strongswan.org>
Mon, 6 Jan 2014 14:30:02 +0000 (15:30 +0100)
The cast to a bool* cut of the actual value on big-endian systems
if bool was shorter than int because the bool argument to printf gets
promoted to an int.

Fixes #479.

src/libstrongswan/utils/utils.c

index 266fb43..4bacb58 100644 (file)
@@ -570,7 +570,7 @@ int time_printf_hook(printf_hook_data_t *data, printf_hook_spec_t *spec,
                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
        };
        time_t *time = *((time_t**)(args[0]));
-       bool utc = *((bool*)(args[1]));;
+       bool utc = *((int*)(args[1]));
        struct tm t;
 
        if (*time == UNDEFINED_TIME)