1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-30 01:55:30 +00:00

Check for NULL to avoid segmentation fault.

Entering in cookie dialog expires:
123456789012345678
and then Info button, caused segfault.
This commit is contained in:
Witold Filipczyk 2018-08-18 20:53:40 +02:00
parent b4766aa0cd
commit 6f001ea50f

View File

@ -255,6 +255,9 @@ add_date_to_string(struct string *string, const unsigned char *fmt,
time_t when_time = date ? *date : time(NULL);
struct tm *when_local = localtime(&when_time);
if (!when_local)
return NULL;
if (strftime(buffer, sizeof(buffer), fmt, when_local) <= 0)
return NULL;