From 2c0943599b7ec40a0ffc7f975dd741b1fe6353f8 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Wed, 12 Jun 2013 13:39:56 +0000 Subject: [PATCH] Merge r1491221, r1491479, r1491538 from trunk: Reduce stack usage, 32 bytes are enough here, no need to take 8k in the stack. (19 would be enough, but be safe...) Use the size of the buffer as opposed to MAX_STRING_LEN. Reduce stack usage, 32 bytes are enough here, no need to take 8k in the stack. (19 would be enough, but be safe...) Use the size of the buffer as opposed to MAX_STRING_LEN. Followup to r1491221+r1491479: change consistently the same code used in another place in the same file. Submitted by: jailletc36, minfrin, rjung Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1492198 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 7 ------- modules/generators/mod_autoindex.c | 8 ++++---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/STATUS b/STATUS index dc341b41c1..0da7d19a1a 100644 --- a/STATUS +++ b/STATUS @@ -95,13 +95,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] - * mod_autoindex: reduce stack usage in 'output_directories' by 8k - trunk patch: http://svn.apache.org/r1491221 - http://svn.apache.org/r1491479 - http://svn.apache.org/r1491538 - 2.4.x patch: trunk patch works - +1: jailletc36, rjung, jim - * mod_cache_socache: Use the name of the socache implementation when performing a lookup rather than using the raw arguments. PR 55062 trunk patch: http://svn.apache.org/r1491458 diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 78a774ef15..3d36c77b81 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -1752,10 +1752,10 @@ static void output_directories(struct ent **ar, int n, } if (!(autoindex_opts & SUPPRESS_LAST_MOD)) { if (ar[x]->lm != -1) { - char time_str[MAX_STRING_LEN]; + char time_str[32]; apr_time_exp_t ts; apr_time_exp_lt(&ts, ar[x]->lm); - apr_strftime(time_str, &rv, MAX_STRING_LEN, + apr_strftime(time_str, &rv, sizeof(time_str), "%Y-%m-%d %H:%M ", &ts); ap_rvputs(r, "style_sheet != NULL) ? " class=\"indexcollastmod\">" : " align=\"right\">",time_str, NULL); @@ -1840,10 +1840,10 @@ static void output_directories(struct ent **ar, int n, ap_rputs(" ", r); if (!(autoindex_opts & SUPPRESS_LAST_MOD)) { if (ar[x]->lm != -1) { - char time_str[MAX_STRING_LEN]; + char time_str[32]; apr_time_exp_t ts; apr_time_exp_lt(&ts, ar[x]->lm); - apr_strftime(time_str, &rv, MAX_STRING_LEN, + apr_strftime(time_str, &rv, sizeof(time_str), "%Y-%m-%d %H:%M ", &ts); ap_rputs(time_str, r); } -- 2.50.1