Fossil

View Ticket
Login
Ticket Hash: d7169e51ebb3400f6fa54901c432f3a4eb86a8f3
Title: vfile_scan.c closing unopened directory
Status: Fixed Type: Code_Defect
Severity: Severe Priority:
Subsystem: Resolution: Fixed
Last Modified: 2011-02-16 19:20:35
Version Found In: 400a07e4a5
Description:
src/vfile_scan.c is using closedir(3) on an uninitialized value when an opendir(3) fails.

<hr /><i>anonymous claiming to be sean added on 2011-02-16 19:01:50 UTC:</i><br />
Please disregard the patch src-vfile.c.patch and use the src-opendir.patch. This should fix the problem when a user attempts to opendir(3) a directory that they don't have permission to examine.

<verbatim>% cd /tmp/
% mkdir fs-test
% cd fs-test/
% fs open ~/src/.fossils/
% fs open ~/src/.fossils/fossil-test-repository 
test.sh
project-name: <unnamed>
repository:   /Users/sean/src/.fossils/fossil-test-repository
local-root:   /private/tmp/fs-test/
project-code: 70164ac6b1269749f782f3dfce03f9cae7fc0c64
server-code:  4d7de95913a31ac17b29e29e96794b42d2575025
checkout:     25317d0b17378032e0120a58e3bb2d8c0b9fd99d 2011-02-08 22:17:00 UTC
parent:       ef432a9584e7771b7ac82ba058ecff84f744deb1 2011-02-08 16:31:20 UTC
tags:         trunk
comment:      Updating test (user: sean)
% ll
total 24
-rw-r--r--  1 sean  wheel  7168 Feb 16 10:58 _FOSSIL_
-rwxr-xr-x  1 sean  wheel    29 Feb 16 10:58 test.sh
% mkdir enoperm
% sudo chmod 700 enoperm
Password:
% sudo chown root:wheel enoperm
% sudo touch enoperm/...
% fs stat
repository:   /Users/sean/src/.fossils/fossil-test-repository
local-root:   /private/tmp/fs-test/
server-code:  4d7de95913a31ac17b29e29e96794b42d2575025
checkout:     25317d0b17378032e0120a58e3bb2d8c0b9fd99d 2011-02-08 22:17:00 UTC
parent:       ef432a9584e7771b7ac82ba058ecff84f744deb1 2011-02-08 16:31:20 UTC
tags:         trunk
comment:      Updating test (user: sean)
% fs extra
Segmentation fault
Exit 139
# test after patch
% ~/src/fossil/fossil stat
repository:   /Users/sean/src/.fossils/fossil-test-repository
local-root:   /private/tmp/fs-test/
server-code:  4d7de95913a31ac17b29e29e96794b42d2575025
checkout:     25317d0b17378032e0120a58e3bb2d8c0b9fd99d 2011-02-08 22:17:00 UTC
parent:       ef432a9584e7771b7ac82ba058ecff84f744deb1 2011-02-08 16:31:20 UTC
tags:         trunk
comment:      Updating test (user: sean)
% ~/src/fossil/fossil extra
% 
</verbatim>

Thanks. -sc

Attachments: