Ticket #13375: 0033-vfs.cpp-fix-use-after-free.patch

File 0033-vfs.cpp-fix-use-after-free.patch, 740 bytes (added by mt, 8 years ago)
  • src/system/boot/loader/vfs.cpp

    From 082b8bff2fff57f856845ce76d0e1e4f5e5a3434 Mon Sep 17 00:00:00 2001
    From: Murai Takashi <tmurai01@gmail.com>
    Date: Mon, 13 Mar 2017 15:31:48 +0900
    Subject: [PATCH 33/33] vfs.cpp: fix use after free.
    
    ---
     src/system/boot/loader/vfs.cpp | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/src/system/boot/loader/vfs.cpp b/src/system/boot/loader/vfs.cpp
    index 2a57686..e9673ea 100644
    a b int  
    12031203closedir(DIR* dir)
    12041204{
    12051205    if (dir != NULL) {
    1206         dir->directory->Close(dir->cookie);
    1207         dir->directory->Release();
     1206        if (dir->directory->Close(dir->cookie) == B_OK) {
     1207            dir->directory->Release();
     1208        }
    12081209        delete dir;
    12091210    }
    12101211