diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-09-01 12:38:36 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-09-01 13:16:44 -0700 |
| commit | baa1e8790d6c8d04de5a371a1c231ca9f2caa3b0 (patch) | |
| tree | a673ac57c2af4be9234f626cfb5617c9662141c8 /src/rt/rust_builtin.cpp | |
| parent | 4951bb8bfc1cfcc7bc0df9ebdaf86610a2c2658f (diff) | |
| download | rust-baa1e8790d6c8d04de5a371a1c231ca9f2caa3b0.tar.gz rust-baa1e8790d6c8d04de5a371a1c231ca9f2caa3b0.zip | |
Check error code in rust_file_is_dir. Prevent comparison of uninitialized mem
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 1b57d0adb83..3e89d12e438 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -446,7 +446,9 @@ rust_dirent_filename(rust_task *task, dirent* ent) { extern "C" CDECL int rust_file_is_dir(rust_task *task, rust_str *path) { struct stat buf; - stat((char*)path->data, &buf); + if (stat((char*)path->data, &buf)) { + return 0; + } return S_ISDIR(buf.st_mode); } |
