소스 검색

Fix use of uninitialized value. (#5867)

If the stat command fails, statbuf is uninitialized.
Marco Feuerstein 10 달 전
부모
커밋
6520354a58
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      code/Common/DefaultIOSystem.cpp

+ 3 - 1
code/Common/DefaultIOSystem.cpp

@@ -104,7 +104,9 @@ bool DefaultIOSystem::Exists(const char *pFile) const {
     }
 #else
 	struct stat statbuf;
-    stat(pFile, &statbuf);
+    if (stat(pFile, &statbuf) != 0) {
+        return false;
+    }
     // test for a regular file
     if (!S_ISREG(statbuf.st_mode)) {
         return false;