aboutsummaryrefslogtreecommitdiff
path: root/programs/daytime_server_upcall.c
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@fh-muenster.de>2020-05-18 14:09:04 +0200
committerMichael Tuexen <tuexen@fh-muenster.de>2020-05-18 14:09:04 +0200
commitd98d2c4c6f4a6a8cafef2a6a2c81de0137a07da0 (patch)
tree600285fcf4330386fd6cc98a0dc63f44e09be67b /programs/daytime_server_upcall.c
parenta05154264872ec8e5d4143ac841a306f54ace231 (diff)
downloadusrsctp-d98d2c4c6f4a6a8cafef2a6a2c81de0137a07da0.tar.gz
Check return value of snprintf().
This should fix https://github.com/sctplab/usrsctp/issues/453.
Diffstat (limited to 'programs/daytime_server_upcall.c')
-rw-r--r--programs/daytime_server_upcall.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/programs/daytime_server_upcall.c b/programs/daytime_server_upcall.c
index b85cb256..87017cf2 100644
--- a/programs/daytime_server_upcall.c
+++ b/programs/daytime_server_upcall.c
@@ -69,10 +69,12 @@ handle_accept(struct socket *sock, void *data, int flags)
}
time(&now);
#ifdef _WIN32
- _snprintf(buffer, sizeof(buffer), "%s", ctime(&now));
+ if (_snprintf(buffer, sizeof(buffer), "%s", ctime(&now)) < 0) {
#else
- snprintf(buffer, sizeof(buffer), "%s", ctime(&now));
+ if (snprintf(buffer, sizeof(buffer), "%s", ctime(&now)) < 0) {
#endif
+ buffer[0] = '\0';
+ }
sndinfo.snd_sid = 0;
sndinfo.snd_flags = 0;
sndinfo.snd_ppid = htonl(DAYTIME_PPID);