diff --git a/interfaces/innerkits/unwinder/src/maps/dfx_map.cpp b/interfaces/innerkits/unwinder/src/maps/dfx_map.cpp index d1c7a8317507714e1c8bca91497a109a2ece6227..92af99a1e566fcb34475b60298c7fb11db9e9dea 100644 --- a/interfaces/innerkits/unwinder/src/maps/dfx_map.cpp +++ b/interfaces/innerkits/unwinder/src/maps/dfx_map.cpp @@ -248,7 +248,7 @@ bool DfxMap::Parse(char* buf, size_t size) path = SkipWhiteSpace(cp); perms = std::string(permChs, sizeof(permChs)); - if (path != nullptr) { // Prevent null pointer dereference when using TrimAndDupStr + if (path != nullptr && path < buf + size - 1) { // Prevent null pointer dereference when using TrimAndDupStr TrimAndDupStr(path, name); } return true;