Proper escape : and \ when binding intent

This commit is contained in:
LoveSy 2022-02-11 17:07:28 +08:00 committed by GitHub
parent c849759682
commit 88e8f2bf83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,8 @@
#include "su.hpp"
#include "daemon.hpp"
extern int SDK_INT;
using namespace std;
#define CALL_PROVIDER \
@ -81,7 +83,14 @@ public:
break;
case STRING:
str += ":s:";
str += str_val;
if (SDK_INT >= 30) {
string tmp = str_val;
replace_all(tmp, "\\", "\\\\");
replace_all(tmp, ":", "\\:");
str += tmp;
} else {
str += str_val;
}
break;
}
vec.push_back("--extra");