OSDN Git Service
(root)
/
android-x86
/
system-extras.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
797116b
)
Simpleperf: check value returned by fopen.
author
Yabin Cui
<yabinc@google.com>
Wed, 9 Dec 2015 03:25:13 +0000
(19:25 -0800)
committer
Yabin Cui
<yabinc@google.com>
Wed, 9 Dec 2015 03:25:13 +0000
(19:25 -0800)
Change-Id: Iecddf0b7805ccc2ad930bab2cdfcefa0702e5661
simpleperf/read_elf.cpp
patch
|
blob
|
history
diff --git
a/simpleperf/read_elf.cpp
b/simpleperf/read_elf.cpp
index
4774ea3
..
a7399ce
100644
(file)
--- a/
simpleperf/read_elf.cpp
+++ b/
simpleperf/read_elf.cpp
@@
-46,7
+46,10
@@
bool IsValidElfPath(const std::string& filename) {
if (!IsRegularFile(filename)) {
return false;
}
- FILE* fp = fopen(filename.c_str(), "rb");
+ FILE* fp = fopen(filename.c_str(), "reb");
+ if (fp == nullptr) {
+ return false;
+ }
char buf[4];
if (fread(buf, 4, 1, fp) != 1) {
fclose(fp);