summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2019-06-07 12:01:28 +0000
committerIvan Zhakov <ivan@apache.org>2019-06-07 12:01:28 +0000
commitbe81d32ebf4ab1c7c263500180b240036e48102e (patch)
treecdb47d25a498783873edc9049f6f072e85deb8fa /file_io
parentb569ef6670876221b83f10403e89d477dd1c18aa (diff)
downloadapr-be81d32ebf4ab1c7c263500180b240036e48102e.tar.gz
Windows platform: Fix access to uninitialized memory in apr_dir_read() when
wanted is more than APR_FINFO_MIN. git-svn-id: https://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';