X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/7246dc4381c6c95454672a5c1aff65a02d6d3747..932f65c37388220298b44c65e601c593e4e40b9e:/components/datetime.c?ds=sidebyside diff --git a/components/datetime.c b/components/datetime.c index 0816923..6dc9678 100644 --- a/components/datetime.c +++ b/components/datetime.c @@ -9,8 +9,10 @@ datetime(const char *fmt) time_t t; t = time(NULL); - if (strftime(buf, sizeof(buf), fmt, localtime(&t)) == 0) + if (!strftime(buf, sizeof(buf), fmt, localtime(&t))) { + fprintf(stderr, "strftime: Result string exceeds buffer size\n"); return NULL; + } return buf; }