From ce1f5e6a49a11252538dd685c524edfefcd69573 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Tue, 14 Mar 2023 12:19:34 +0000 Subject: 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 --- server/util_time.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server') 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; } -- cgit v1.2.3