Skip to content

Commit

Permalink
allow for strftime() %Z timezone to be >4 chars
Browse files Browse the repository at this point in the history
In create_long_time_string(), the strftime() buffer reserves 4 bytes
for the %Z timezone abbreviation.  This limit is insufficient for some
locales (eg, "GMT-1").  The zoneinfo database shows some as long as
8 characters.

This increases the strftime() buffer to 32 bytes which reserves 11
bytes for the %Z timezone.

Fixes issue 16.
  • Loading branch information
Mark Salyzyn authored and dun committed Jan 3, 2013
1 parent 9c42719 commit 858ecb4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util-str.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ char * create_long_time_string(time_t t)
{
char *p;
struct tm tm;
const int len = 25; /* YYYY-MM-DD HH:MM:SS ZONE + NUL */
const int len = 32;

if (!(p = malloc(len))) {
out_of_memory();
Expand Down

0 comments on commit 858ecb4

Please sign in to comment.