aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-06-19 00:37:57 +0200
committerToni Uhlig <matzeton@googlemail.com>2020-06-19 00:37:57 +0200
commit9e327e44db5bc5aff1e3cba9e443e666e9f712df (patch)
tree2941f7353d8c621385025c5b39fe7ed80d55bf37
parent9f743e36909ba5509edaacd3f0e0edee625a72f5 (diff)
fixed crash on musl
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--protocol.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/protocol.c b/protocol.c
index 7f1032a..940e0cd 100644
--- a/protocol.c
+++ b/protocol.c
@@ -504,7 +504,11 @@ static int create_timestamp(struct tm * const timestamp,
*usec = ts_val.tv_usec;
ts = time(NULL);
gmtime_r(&ts, timestamp);
- return strftime(timestamp_str, PROTOCOL_TIME_STRLEN, "%a, %d %b %Y %T %z", timestamp);
+
+ if (timestamp_str) {
+ return strftime(timestamp_str, PROTOCOL_TIME_STRLEN, "%a, %d %b %Y %T %z", timestamp);
+ }
+ return 0;
}
void protocol_response_ping(unsigned char out[CRYPT_PACKET_SIZE_PING], struct connection * const state)