News for hackers. Stuff that matters.
Re:You can't copy code with memcpy by jrtc27 on Thursday December 30, 2021 @08:18PM (#29743748)
You can allocate memory in another process on Unix too: use ptrace to make the other process call malloc (use PTRACE_SETREGS to set PC to malloc and the first argument register to the number of bytes, then intercept the return).

GDB will use this if you tell it something like `p foo("bar")`, as it needs to allocate memory for that string somewhere.

There are no comments on this comment yet.