From: Yann Ylavic Date: Tue, 14 Mar 2023 12:19:34 +0000 (+0000) Subject: util_time: Note/comments about ap_recent_ctime_ex() correctness wrt trailing \0 X-Git-Tag: 2.5.0-alpha2-ci-test-only~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce1f5e6a49a11252538dd685c524edfefcd69573;p=thirdparty%2Fapache%2Fhttpd.git 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 --- diff --git a/server/util_time.c b/server/util_time.c index 95df38d8b9f..8fa7b19859f 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; }