mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 20:37:39 +00:00
Fix remote_write implementation
This commit is contained in:
parent
18b86e4fd2
commit
cd23d27048
@ -131,7 +131,7 @@ bool _remote_write(int pid, uintptr_t addr, const void *buf, size_t len) {
|
||||
for (size_t i = 0; i < len; i += sizeof(long)) {
|
||||
long data = 0;
|
||||
memcpy(&data, static_cast<const uint8_t *>(buf) + i, std::min(len - i, sizeof(data)));
|
||||
if (xptrace(PTRACE_POKETEXT, pid, reinterpret_cast<void*>(addr + i), &data) < 0)
|
||||
if (xptrace(PTRACE_POKETEXT, pid, reinterpret_cast<void*>(addr + i), data) < 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -47,10 +47,6 @@ pid_set attaches;
|
||||
* Utils
|
||||
********/
|
||||
|
||||
static inline long xptrace(int request, pid_t pid, void *addr, uintptr_t data) {
|
||||
return xptrace(request, pid, addr, reinterpret_cast<void *>(data));
|
||||
}
|
||||
|
||||
static inline int read_ns(const int pid, struct stat *st) {
|
||||
char path[32];
|
||||
sprintf(path, "/proc/%d/ns/mnt", pid);
|
||||
|
@ -61,3 +61,6 @@ int xinotify_init1(int flags);
|
||||
char *xrealpath(const char *path, char *resolved_path);
|
||||
int xmknod(const char *pathname, mode_t mode, dev_t dev);
|
||||
long xptrace(int request, pid_t pid, void *addr = nullptr, void *data = nullptr);
|
||||
static inline long xptrace(int request, pid_t pid, void *addr, uintptr_t data) {
|
||||
return xptrace(request, pid, addr, reinterpret_cast<void *>(data));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user