Help for ptrace

Ptrace::read() only get upto 8 bytes

I have input 5 character and reads the address also converts into character i got upto to only 3 readable character.

how can i get other readable character??? Help..

I'm not sure which implementation you're referring to, but if that read() method is from Rust's io::Read trait, then it's a terrible footgun that doesn't guarantee how much it will read. Don't use it. Use read_exact() instead, which will read the amount of bytes you tell it to.

(same goes for write() which is unreliable, and write_all() that actually writes the data)

I am using nix::sys::ptrace::read(pid, addr)

Reading a certain address.

Are you sure that whatever data you want to read is at the address you passed to nix::sys::ptrace::read? nix::sys::ptrace::read does not do partial reads unlike std::io::Read::read().

Yep ptrace::read only reads 8 bytes my data is more than 8 bytes

Please show your code.

If you want to read more than 8 bytes using the ptrace interface, you have to split it into multiple 8 byte read operations.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.