From: Yann Ylavic Date: Tue, 14 Mar 2023 15:41:42 +0000 (+0000) Subject: util_time: Follow up to r1908380: Avoid apr_snprintf() like others. X-Git-Tag: 2.5.0-alpha2-ci-test-only~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4be3a3b630475dedf35832d49c3cdc5d37615f2e;p=thirdparty%2Fapache%2Fhttpd.git util_time: Follow up to r1908380: Avoid apr_snprintf() like others. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908389 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util_time.c b/server/util_time.c index 8fa7b19859f..033d05ef6cd 100644 --- a/server/util_time.c +++ b/server/util_time.c @@ -262,18 +262,22 @@ AP_DECLARE(apr_status_t) ap_recent_ctime_ex(char *date_str, apr_time_t t, *date_str++ = real_year % 10 + '0'; } if (option & AP_CTIME_OPTION_GMTOFF) { - int off = xt.tm_gmtoff; + int off = xt.tm_gmtoff, off_hh, off_mm; char sign = '+'; if (off < 0) { off = -off; sign = '-'; } - apr_snprintf(date_str, AP_CTIME_GMTOFF_LEN + 1, " %c%.2d%.2d", - sign, off / 3600, (off % 3600) / 60); - } - else { - *date_str = 0; + off_hh = off / 3600; + off_mm = off % 3600 / 60; + *date_str++ = ' '; + *date_str++ = sign; + *date_str++ = off_hh / 10 + '0'; + *date_str++ = off_hh % 10 + '0'; + *date_str++ = off_mm / 10 + '0'; + *date_str++ = off_mm % 10 + '0'; } + *date_str = 0; return APR_SUCCESS; }