summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2023-03-14 13:19:34 +0100
committerYann Ylavic <ylavic@apache.org>2023-03-14 13:19:34 +0100
commitce1f5e6a49a11252538dd685c524edfefcd69573 (patch)
treed086a2f744ebc1d78718957c47ed78cf5b922b6a /server
parentcore: Add formats %{z} and %{strftime-format} to ErrorLogFormat. PR 62161. (diff)
downloadapache2-ce1f5e6a49a11252538dd685c524edfefcd69573.tar.xz
apache2-ce1f5e6a49a11252538dd685c524edfefcd69573.zip
util_time: Note/comments about ap_recent_ctime_ex() correctness wrt trailing \0
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908383 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/util_time.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/util_time.c b/server/util_time.c
index 95df38d8b9..8fa7b19859 100644
--- a/server/util_time.c
+++ b/server/util_time.c
@@ -25,7 +25,7 @@
* */
#define AP_CTIME_USEC_LENGTH 7
-/* Length of ISO 8601 date/time */
+/* Length of ISO 8601 date/time (including trailing '\0') */
#define AP_CTIME_COMPACT_LEN 20
/* Length of timezone offset from GMT ([+-]hhmm) plus leading space */
@@ -190,7 +190,9 @@ AP_DECLARE(apr_status_t) ap_recent_ctime_ex(char *date_str, apr_time_t t,
needed += AP_CTIME_GMTOFF_LEN;
}
- /* Check the provided buffer length */
+ /* Check the provided buffer length (note: above AP_CTIME_COMPACT_LEN
+ * and APR_CTIME_LEN include the trailing '\0'; so does 'needed' then).
+ */
if (len && *len >= needed) {
*len = needed;
}