diff options
author | Vincent Loupmon <vincentloupmon@gmail.com> | 2016-03-10 10:53:14 +0100 |
---|---|---|
committer | Vincent Loupmon <vincentloupmon@gmail.com> | 2016-03-10 10:53:14 +0100 |
commit | 790e150a1c6a935a154127b36deaec36d4a5bcc6 (patch) | |
tree | 96e469916ae1818af3ae2f6dc94fce4f8da4a07a | |
parent | 8286bd8a374910d24f925e9f38931cd5dbfb22d1 (diff) |
Fixed small buffer in get_datetime()
The buffer being hardcoded to 19 (the size expected from the default time format),
strftime() would fail on any format returning a longer buffer.
Changed it from 19 to 64 to accomodate longer formats.
-rw-r--r-- | slstatus.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -143,13 +143,13 @@ char * get_datetime() { time_t tm; - size_t bufsize = 19; + size_t bufsize = 64; char *buf = malloc(bufsize); /* get time in format */ time(&tm); if(!strftime(buf, bufsize, timeformat, localtime(&tm))) { - fprintf(stderr, "Strftime failed.\n"); + fprintf(stderr, "Strftime failed.\n"); exit(1); } |