3

I know I could write an interposer to watch the arguments being passed to the strncpy library call, but it seems like this should be easy to do with DTrace.

1 Answer 1

5

Here's a working variant (tested on Mac only):

 #!/usr/sbin/dtrace -s pid$target::strncpy:entry { printf( "%s( %X, %s, %lld )\n", probefunc, arg0, copyinstr(arg1), arg2 ); } 

copyinstr is required since the string comes from userland into the kernel.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.