]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
util_time: Note/comments about ap_recent_ctime_ex() correctness wrt trailing \0
authorYann Ylavic <ylavic@apache.org>
Tue, 14 Mar 2023 12:19:34 +0000 (12:19 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 14 Mar 2023 12:19:34 +0000 (12:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908383 13f79535-47bb-0310-9956-ffa450edef68

server/util_time.c

index 95df38d8b9f1432cdc4bde313da925100cde0ca6..8fa7b19859f0c2f50b3767f7ea1bbfdb2c118472 100644 (file)
@@ -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;
     }