summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2019-06-07 12:01:28 +0000
committerivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2019-06-07 12:01:28 +0000
commit94a39b2a189302ce327acd33d2d569e1229425c1 (patch)
treecdb47d25a498783873edc9049f6f072e85deb8fa /file_io
parent5ee2ff10d9da250da033531a72a385584b6cef3b (diff)
downloadlibapr-94a39b2a189302ce327acd33d2d569e1229425c1.tar.gz
Windows platform: Fix access to uninitialized memory in apr_dir_read() when
wanted is more than APR_FINFO_MIN. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1860747 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r--file_io/win32/dir.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/file_io/win32/dir.c b/file_io/win32/dir.c
index 35860b61d..6ddcfe64b 100644
--- a/file_io/win32/dir.c
+++ b/file_io/win32/dir.c
@@ -172,8 +172,18 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
/* Almost all our work is done. Tack on the wide file name
* to the end of the wdirname (already / delimited)
*/
- if (!eos)
+ if (!eos) {
+ /* It's more efficient to store WDIRNAME in THEDIR,
+ * but let's make simple fix first. */
+ if ((rv = utf8_to_unicode_path(wdirname, sizeof(wdirname)
+ / sizeof(apr_wchar_t),
+ thedir->dirname))) {
+ return rv;
+ }
+
eos = wcschr(wdirname, '\0');
+ }
+
wcscpy(eos, thedir->w.entry->cFileName);
rv = more_finfo(finfo, wdirname, wanted, MORE_OF_WFSPEC);
eos[0] = '\0';