From: Vincent Loupmon Date: Thu, 10 Mar 2016 09:53:14 +0000 (+0100) Subject: Fixed small buffer in get_datetime() X-Git-Url: https://git.atheridis.org/?a=commitdiff_plain;h=790e150a1c6a935a154127b36deaec36d4a5bcc6;p=suckless%2Fslstatus.git 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. --- diff --git a/slstatus.c b/slstatus.c index 331a345..28a8caa 100644 --- a/slstatus.c +++ b/slstatus.c @@ -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); }