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:
Michael Jerris committed 2008-10-12 21:51:51 +00:00
1 parent a21b5ed2ad
commit 1f47ff15b3
14 files changed
+92 -28

No files matched your search

@@ -1022,7 +1022,11 @@ SWITCH_STANDARD_API(strftime_api_function)
thetime = switch_timestamp_now();
}
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);
return SWITCH_STATUS_SUCCESS;