validate strftime format string input (when necessary)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9985 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
a21b5ed2ad
commit
1f47ff15b3
|
@ -270,6 +270,16 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, s
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm);
|
SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* formats the exploded time according to the format specified (does not validate format string)
|
||||||
|
* @param s string to write to
|
||||||
|
* @param retsize The length of the returned string
|
||||||
|
* @param max The maximum length of the string
|
||||||
|
* @param format The format for the time string
|
||||||
|
* @param tm The time to convert
|
||||||
|
*/
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_strftime_nocheck(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* switch_rfc822_date formats dates in the RFC822
|
* switch_rfc822_date formats dates in the RFC822
|
||||||
* format in an efficient manner. It is a fixed length
|
* format in an efficient manner. It is a fixed length
|
||||||
|
|
|
@ -1022,7 +1022,11 @@ SWITCH_STANDARD_API(strftime_api_function)
|
||||||
thetime = switch_timestamp_now();
|
thetime = switch_timestamp_now();
|
||||||
}
|
}
|
||||||
switch_time_exp_lt(&tm, thetime);
|
switch_time_exp_lt(&tm, thetime);
|
||||||
switch_strftime(date, &retsize, sizeof(date), switch_strlen_zero(cmd) ? "%Y-%m-%d %T" : cmd, &tm);
|
if (switch_strlen_zero(cmd)) {
|
||||||
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
|
} else {
|
||||||
|
switch_strftime(date, &retsize, sizeof(date), cmd, &tm);
|
||||||
|
}
|
||||||
stream->write_function(stream, "%s", date);
|
stream->write_function(stream, "%s", date);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
|
@ -520,7 +520,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
ts = switch_timestamp_now();
|
ts = switch_timestamp_now();
|
||||||
switch_time_exp_lt(&tm, ts);
|
switch_time_exp_lt(&tm, ts);
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
switch_channel_set_variable(channel, "fifo_status", "WAITING");
|
switch_channel_set_variable(channel, "fifo_status", "WAITING");
|
||||||
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
||||||
|
|
||||||
|
@ -613,7 +613,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
} else {
|
} else {
|
||||||
ts = switch_timestamp_now();
|
ts = switch_timestamp_now();
|
||||||
switch_time_exp_lt(&tm, ts);
|
switch_time_exp_lt(&tm, ts);
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
switch_channel_set_variable(channel, "fifo_status", cd.do_orbit ? "TIMEOUT" : "ABORTED");
|
switch_channel_set_variable(channel, "fifo_status", cd.do_orbit ? "TIMEOUT" : "ABORTED");
|
||||||
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
ts = switch_timestamp_now();
|
ts = switch_timestamp_now();
|
||||||
switch_time_exp_lt(&tm, ts);
|
switch_time_exp_lt(&tm, ts);
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
switch_channel_set_variable(channel, "fifo_status", "WAITING");
|
switch_channel_set_variable(channel, "fifo_status", "WAITING");
|
||||||
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
||||||
|
|
||||||
|
@ -883,7 +883,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
ts = switch_timestamp_now();
|
ts = switch_timestamp_now();
|
||||||
switch_time_exp_lt(&tm, ts);
|
switch_time_exp_lt(&tm, ts);
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
switch_channel_set_variable(channel, "fifo_status", "TALKING");
|
switch_channel_set_variable(channel, "fifo_status", "TALKING");
|
||||||
switch_channel_set_variable(channel, "fifo_target", uuid);
|
switch_channel_set_variable(channel, "fifo_target", uuid);
|
||||||
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
||||||
|
@ -910,7 +910,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
ts = switch_timestamp_now();
|
ts = switch_timestamp_now();
|
||||||
switch_time_exp_lt(&tm, ts);
|
switch_time_exp_lt(&tm, ts);
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
switch_channel_set_variable(channel, "fifo_status", "WAITING");
|
switch_channel_set_variable(channel, "fifo_status", "WAITING");
|
||||||
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
||||||
|
|
||||||
|
|
|
@ -480,7 +480,7 @@ SWITCH_STANDARD_APP(rss_function)
|
||||||
char dtmf[5] = "";
|
char dtmf[5] = "";
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, switch_timestamp_now());
|
switch_time_exp_lt(&tm, switch_timestamp_now());
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%I:%M %p", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%I:%M %p", &tm);
|
||||||
|
|
||||||
|
|
||||||
switch_snprintf(buf, sizeof(buf),
|
switch_snprintf(buf, sizeof(buf),
|
||||||
|
|
|
@ -2728,7 +2728,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons
|
||||||
free(dbuf);
|
free(dbuf);
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, ts);
|
switch_time_exp_lt(&tm, ts);
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
switch_channel_set_variable(channel, "RECORD_DATE", date);
|
switch_channel_set_variable(channel, "RECORD_DATE", date);
|
||||||
switch_channel_set_variable(channel, "RECORD_SOFTWARE", "FreeSWITCH");
|
switch_channel_set_variable(channel, "RECORD_SOFTWARE", "FreeSWITCH");
|
||||||
switch_channel_set_variable(channel, "RECORD_TITLE", profile->record_title);
|
switch_channel_set_variable(channel, "RECORD_TITLE", profile->record_title);
|
||||||
|
@ -3176,13 +3176,13 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||||
|
|
||||||
if (l_created) {
|
if (l_created) {
|
||||||
switch_time_exp_lt(&tm, l_created);
|
switch_time_exp_lt(&tm, l_created);
|
||||||
switch_strftime(create_date, &retsize, sizeof(create_date), fmt, &tm);
|
switch_strftime_nocheck(create_date, &retsize, sizeof(create_date), fmt, &tm);
|
||||||
switch_strftime(rss_date, &retsize, sizeof(create_date), "%D %T", &tm);
|
switch_strftime_nocheck(rss_date, &retsize, sizeof(create_date), "%D %T", &tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l_read) {
|
if (l_read) {
|
||||||
switch_time_exp_lt(&tm, l_read);
|
switch_time_exp_lt(&tm, l_read);
|
||||||
switch_strftime(read_date, &retsize, sizeof(read_date), fmt, &tm);
|
switch_strftime_nocheck(read_date, &retsize, sizeof(read_date), fmt, &tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
|
switch_snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
|
||||||
|
@ -3256,13 +3256,13 @@ static int rss_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||||
|
|
||||||
if (l_created) {
|
if (l_created) {
|
||||||
switch_time_exp_lt(&tm, l_created);
|
switch_time_exp_lt(&tm, l_created);
|
||||||
switch_strftime(create_date, &retsize, sizeof(create_date), fmt, &tm);
|
switch_strftime_nocheck(create_date, &retsize, sizeof(create_date), fmt, &tm);
|
||||||
switch_strftime(rss_date, &retsize, sizeof(create_date), fmt, &tm);
|
switch_strftime_nocheck(rss_date, &retsize, sizeof(create_date), fmt, &tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l_read) {
|
if (l_read) {
|
||||||
switch_time_exp_lt(&tm, l_read);
|
switch_time_exp_lt(&tm, l_read);
|
||||||
switch_strftime(read_date, &retsize, sizeof(read_date), fmt, &tm);
|
switch_strftime_nocheck(read_date, &retsize, sizeof(read_date), fmt, &tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
holder->x_item = switch_xml_add_child_d(holder->x_channel, "item", holder->items++);
|
holder->x_item = switch_xml_add_child_d(holder->x_channel, "item", holder->items++);
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ static int show_reg_callback(void *pArg, int argc, char **argv, char **columnNam
|
||||||
switch_size_t retsize;
|
switch_size_t retsize;
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, switch_time_from_sec(etime));
|
switch_time_exp_lt(&tm, switch_time_from_sec(etime));
|
||||||
switch_strftime(exp_buf, &retsize, sizeof(exp_buf), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(exp_buf, &retsize, sizeof(exp_buf), "%Y-%m-%d %T", &tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
cb->stream->write_function(cb->stream,
|
cb->stream->write_function(cb->stream,
|
||||||
|
|
|
@ -100,7 +100,7 @@ static void do_rotate(cdr_fd_t *fd)
|
||||||
|
|
||||||
if (globals.rotate) {
|
if (globals.rotate) {
|
||||||
switch_time_exp_lt(&tm, switch_timestamp_now());
|
switch_time_exp_lt(&tm, switch_timestamp_now());
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
|
||||||
|
|
||||||
len = strlen(fd->path) + strlen(date) + 2;
|
len = strlen(fd->path) + strlen(date) + 2;
|
||||||
p = switch_mprintf("%s.%s", fd->path, date);
|
p = switch_mprintf("%s.%s", fd->path, date);
|
||||||
|
|
|
@ -125,7 +125,7 @@ static switch_status_t mod_logfile_rotate(logfile_profile_t *profile)
|
||||||
switch_mutex_lock(globals.mutex);
|
switch_mutex_lock(globals.mutex);
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, switch_timestamp_now());
|
switch_time_exp_lt(&tm, switch_timestamp_now());
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
|
||||||
|
|
||||||
profile->log_size = 0;
|
profile->log_size = 0;
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,57 @@ SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t *dso, char *bu
|
||||||
/* string functions */
|
/* string functions */
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm)
|
SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm)
|
||||||
|
{
|
||||||
|
const char *p = format;
|
||||||
|
|
||||||
|
if (!p) return SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
|
while (*p) {
|
||||||
|
if (*p == '%') {
|
||||||
|
switch (*(++p)) {
|
||||||
|
case 'C':
|
||||||
|
case 'D':
|
||||||
|
case 'r':
|
||||||
|
case 'R':
|
||||||
|
case 'T':
|
||||||
|
case 'e':
|
||||||
|
case 'a':
|
||||||
|
case 'A':
|
||||||
|
case 'b':
|
||||||
|
case 'B':
|
||||||
|
case 'c':
|
||||||
|
case 'd':
|
||||||
|
case 'H':
|
||||||
|
case 'I':
|
||||||
|
case 'j':
|
||||||
|
case 'm':
|
||||||
|
case 'M':
|
||||||
|
case 'p':
|
||||||
|
case 'S':
|
||||||
|
case 'U':
|
||||||
|
case 'w':
|
||||||
|
case 'W':
|
||||||
|
case 'x':
|
||||||
|
case 'X':
|
||||||
|
case 'y':
|
||||||
|
case 'Y':
|
||||||
|
case 'z':
|
||||||
|
case 'Z':
|
||||||
|
case '%':
|
||||||
|
p++;
|
||||||
|
continue;
|
||||||
|
case '\0':
|
||||||
|
default:
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm);
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_strftime_nocheck(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm)
|
||||||
{
|
{
|
||||||
return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm);
|
return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2105,40 +2105,39 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
|
||||||
cid_buf = caller_profile->caller_id_number;
|
cid_buf = caller_profile->caller_id_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (caller_profile->times) {
|
if (caller_profile->times) {
|
||||||
switch_time_exp_t tm;
|
switch_time_exp_t tm;
|
||||||
switch_size_t retsize;
|
switch_size_t retsize;
|
||||||
const char *fmt = "%Y-%m-%d %T";
|
const char *fmt = "%Y-%m-%d %T";
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, caller_profile->times->created);
|
switch_time_exp_lt(&tm, caller_profile->times->created);
|
||||||
switch_strftime(start, &retsize, sizeof(start), fmt, &tm);
|
switch_strftime_nocheck(start, &retsize, sizeof(start), fmt, &tm);
|
||||||
switch_channel_set_variable(channel, "start_stamp", start);
|
switch_channel_set_variable(channel, "start_stamp", start);
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, caller_profile->times->profile_created);
|
switch_time_exp_lt(&tm, caller_profile->times->profile_created);
|
||||||
switch_strftime(profile_start, &retsize, sizeof(profile_start), fmt, &tm);
|
switch_strftime_nocheck(profile_start, &retsize, sizeof(profile_start), fmt, &tm);
|
||||||
switch_channel_set_variable(channel, "profile_start_stamp", profile_start);
|
switch_channel_set_variable(channel, "profile_start_stamp", profile_start);
|
||||||
|
|
||||||
if (caller_profile->times->answered) {
|
if (caller_profile->times->answered) {
|
||||||
switch_time_exp_lt(&tm, caller_profile->times->answered);
|
switch_time_exp_lt(&tm, caller_profile->times->answered);
|
||||||
switch_strftime(answer, &retsize, sizeof(answer), fmt, &tm);
|
switch_strftime_nocheck(answer, &retsize, sizeof(answer), fmt, &tm);
|
||||||
switch_channel_set_variable(channel, "answer_stamp", answer);
|
switch_channel_set_variable(channel, "answer_stamp", answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caller_profile->times->progress) {
|
if (caller_profile->times->progress) {
|
||||||
switch_time_exp_lt(&tm, caller_profile->times->progress);
|
switch_time_exp_lt(&tm, caller_profile->times->progress);
|
||||||
switch_strftime(progress, &retsize, sizeof(progress), fmt, &tm);
|
switch_strftime_nocheck(progress, &retsize, sizeof(progress), fmt, &tm);
|
||||||
switch_channel_set_variable(channel, "progress_stamp", progress);
|
switch_channel_set_variable(channel, "progress_stamp", progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caller_profile->times->progress_media) {
|
if (caller_profile->times->progress_media) {
|
||||||
switch_time_exp_lt(&tm, caller_profile->times->progress_media);
|
switch_time_exp_lt(&tm, caller_profile->times->progress_media);
|
||||||
switch_strftime(progress_media, &retsize, sizeof(progress_media), fmt, &tm);
|
switch_strftime_nocheck(progress_media, &retsize, sizeof(progress_media), fmt, &tm);
|
||||||
switch_channel_set_variable(channel, "progress_media_stamp", progress_media);
|
switch_channel_set_variable(channel, "progress_media_stamp", progress_media);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, caller_profile->times->hungup);
|
switch_time_exp_lt(&tm, caller_profile->times->hungup);
|
||||||
switch_strftime(end, &retsize, sizeof(end), fmt, &tm);
|
switch_strftime_nocheck(end, &retsize, sizeof(end), fmt, &tm);
|
||||||
switch_channel_set_variable(channel, "end_stamp", end);
|
switch_channel_set_variable(channel, "end_stamp", end);
|
||||||
|
|
||||||
tt_created = (time_t) (caller_profile->times->created / 1000000);
|
tt_created = (time_t) (caller_profile->times->created / 1000000);
|
||||||
|
|
|
@ -289,7 +289,7 @@ SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, switch_timestamp_now());
|
switch_time_exp_lt(&tm, switch_timestamp_now());
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
|
|
||||||
if (channel == SWITCH_CHANNEL_ID_LOG) {
|
if (channel == SWITCH_CHANNEL_ID_LOG) {
|
||||||
fprintf(handle, "[%d] %s %s:%d %s() %s", (int) getpid(), date, filep, line, func, data);
|
fprintf(handle, "[%d] %s %s:%d %s() %s", (int) getpid(), date, filep, line, func, data);
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, con
|
||||||
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv6", guess_ip_v6);
|
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv6", guess_ip_v6);
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, ts);
|
switch_time_exp_lt(&tm, ts);
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-Local", date);
|
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-Local", date);
|
||||||
switch_rfc822_date(date, ts);
|
switch_rfc822_date(date, ts);
|
||||||
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-GMT", date);
|
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-GMT", date);
|
||||||
|
|
|
@ -265,7 +265,7 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char
|
||||||
switch_time_exp_t tm;
|
switch_time_exp_t tm;
|
||||||
|
|
||||||
switch_time_exp_lt(&tm, now);
|
switch_time_exp_lt(&tm, now);
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
|
|
||||||
len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt));
|
len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt));
|
||||||
new_fmt = malloc(len + 1);
|
new_fmt = malloc(len + 1);
|
||||||
|
|
|
@ -571,7 +571,7 @@ SWITCH_DECLARE(switch_status_t) switch_strftime_tz(const char *tz, const char *f
|
||||||
if (tzdef) { /* The lookup of the zone may fail. */
|
if (tzdef) { /* The lookup of the zone may fail. */
|
||||||
tztime( &timep, tzdef, &tm );
|
tztime( &timep, tzdef, &tm );
|
||||||
tm2switchtime( &tm, &stm );
|
tm2switchtime( &tm, &stm );
|
||||||
switch_strftime(date, &retsize, len, switch_strlen_zero(format) ? "%Y-%m-%d %T" : format, &stm);
|
switch_strftime_nocheck(date, &retsize, len, switch_strlen_zero(format) ? "%Y-%m-%d %T" : format, &stm);
|
||||||
if (!switch_strlen_zero_buf(date)) {
|
if (!switch_strlen_zero_buf(date)) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue