Skip to content

Hook libc.so readdir #2631

Answered by Rablidad
lyf-is-coding asked this question in Q&A
Sep 9, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

if on x86, ino_t and off_t represents 32 bit data offset, also, you don't need to put the string length as an argument to readCString as c strings ends in null terminator characters. which gives:

// x86 => 4 (ino_t) + 4 (off_t) + 2 (unsigned short) + 1 (unsigned char) = 11
let d_name = pointer.add(11).readCString();

// x64 => 8 (ino_t) + 8 (off_t) + 2 (unsigned short) + 1 (unsigned char) = 19
let d_name = pointer.add(19).readCString()

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lyf-is-coding
Comment options

Answer selected by lyf-is-coding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants