Skip to content

Commit

Permalink
Fix off by one in OriginalNamePass check (#473)
Browse files Browse the repository at this point in the history
Summary:
This PR fixes a bug in `strncmp("LX/", cls_type->get_name()->c_str(), 2)` where the size parameter should be 3. When it is 2 this call will miss checking for the `/` character.
Pull Request resolved: #473

Reviewed By: agampe

Differential Revision: D20996439

Pulled By: justinjhendrick

fbshipit-source-id: 3962186a387e71e9195e150d74db59149760ccc6
  • Loading branch information
disconnect3d authored and facebook-github-bot committed Apr 13, 2020
1 parent 8b3de74 commit 6f5bafd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion opt/original_name/OriginalNamePass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void OriginalNamePass::run_pass(DexStoresVector& stores,
DexType* string_type = type::java_lang_String();
for (const auto& it : to_annotate) {
const DexType* cls_type = it.first;
if (strncmp("LX/", cls_type->get_name()->c_str(), 2) != 0) {
if (strncmp("LX/", cls_type->get_name()->c_str(), 3) != 0) {
continue;
}

Expand Down

0 comments on commit 6f5bafd

Please sign in to comment.