The book is from 1996, and there’s a decent chance that the screenshot was made on an older OS that does not have the same memory protection features as a modern OS would have.
Try a few of the following and see if they segfault:
- Read only as much memory as the size of the pointer addr
- Offset the value of addr by -64 and read 64 from there
- Do the same but with smaller values
Could be, yeah.
I guess I didn’t read the code well enough, but I was expecting
addr
to point to somewhere on the stack.I guess that’s something to try - declare and assign a variable and then print the address of it, and then use that to take a look at stack memory.