how to change the variable use Xposed

1.5k Views Asked by At
byte[] buffer = new buffer[1024];
io.read(buffer, 0, buffer.length);

Now I hook the method io.read(), is there a way to change the buffer variable. The buffer length is 1024, I want Xposed to achieve,

byte[] newbuffer = new byte[4096];
buffer = newbuffer;
1

There are 1 best solutions below

0
On

You can probably register a beforeHookedMethod on the io.read to retrieve the read's parameters. You can access these via param.args, just create your new buffer and replace it in the arguments.

Note that intercepting frequently used methods is a bad idea as it can impact performance.