Skip to content

Commit 1e298dd

Browse files
committed
mod_dav: Fix error handling for dav_fs_dir_file_name():
dav_fs_dir_file_name() will not set *fname_p to NULL on failure, and all callers of dav_fs_dir_file_name() does not check the return value of dav_fs_dir_file_name(), which could lead to an undefined behavior against fname_p. Fix this by adding return value check of dav_fs_dir_file_name() Submitted by: Zhou Qingyang <zhou1615 umn.edu> Github: closes #309 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1923813 13f79535-47bb-0310-9956-ffa450edef68
1 parent c36a521 commit 1e298dd

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

modules/dav/fs/repos.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,13 @@ static dav_error *dav_fs_copymoveset(int is_move, apr_pool_t *p,
595595

596596
/* Get directory and filename for resources */
597597
/* ### should test these result values... */
598-
(void) dav_fs_dir_file_name(src, &src_dir, &src_file);
599-
(void) dav_fs_dir_file_name(dst, &dst_dir, &dst_file);
598+
err = dav_fs_dir_file_name(src, &src_dir, &src_file);
599+
if (err != NULL)
600+
return err;
601+
602+
err = dav_fs_dir_file_name(dst, &dst_dir, &dst_file);
603+
if (err != NULL)
604+
return err;
600605

601606
/* Get the corresponding state files for each resource */
602607
dav_dbm_get_statefiles(p, src_file, &src_state1, &src_state2);
@@ -644,11 +649,14 @@ static dav_error *dav_fs_deleteset(apr_pool_t *p, const dav_resource *resource)
644649
const char *state1;
645650
const char *state2;
646651
const char *pathname;
652+
dav_error *err;
647653
apr_status_t status;
648654

649655
/* Get directory, filename, and state-file names for the resource */
650656
/* ### should test this result value... */
651-
(void) dav_fs_dir_file_name(resource, &dirpath, &fname);
657+
err = dav_fs_dir_file_name(resource, &dirpath, &fname);
658+
if (err != NULL)
659+
return err;
652660
dav_dbm_get_statefiles(p, fname, &state1, &state2);
653661

654662
/* build the propset pathname for the file */

0 commit comments

Comments
 (0)