Skip to content

Commit 62bb3e0

Browse files
author
杰洛
committed
修复由于包名重合导致的patch错误问题(如com.bairimeng.dmmdzz和com.bairimeng.dmmdzz.m4399),改为使用可以匹配到的最短base.apk路径;
1 parent 497f781 commit 62bb3e0

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

bootstrap.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -556,18 +556,25 @@ std::string get_apk_path(const std::string& bundle_id)
556556

557557
fp = fopen( "/proc/self/maps", "r" );
558558
if ( fp != NULL ){
559+
int min_len = -1;
559560
while ( fgets( line, sizeof(line), fp ) ){
560561
int line_len = strlen(line);
561562
while(line[line_len - 1] == ' ' || line[line_len - 1] == '\r' || line[line_len - 1] == '\n' || line[line_len - 1] == '\t') {line[line_len - 1] = '\0'; line_len--;}
562-
if ( strstr( line, bundle_id.c_str()) && (memcmp(line + strlen(line) - TAIL_LEN, TAIL, TAIL_LEN) == 0) ){
563-
found_path = strchr( line, '/' );
564-
if (ShadowZip::contains_path(found_path, "assets/bin/Data/"))
563+
if ( strstr( line, bundle_id.c_str()) && (memcmp(line + strlen(line) - TAIL_LEN, TAIL, TAIL_LEN) == 0))
564+
{
565+
if(min_len == -1 || min_len > line_len)
565566
{
566-
ret = std::string(found_path);
567-
break;
567+
found_path = strchr( line, '/' );
568+
min_len = line_len;
568569
}
569570
}
570571
}
572+
573+
if (min_len != -1 && ShadowZip::contains_path(found_path, "assets/bin/Data/"))
574+
{
575+
ret = std::string(found_path);
576+
}
577+
571578
fclose( fp ) ;
572579
}
573580

0 commit comments

Comments
 (0)