On 08/10/2011 03:38 AM, Rich Felker wrote: (Thanks for explaining mprotect first of all) > Especially as you're nearing the deadline, I'd like to ask you to > please listen when I make recommendations like this. Sure learning > about mprotect is educational, but in terms of getting stuff done, if > you'd taken my advice several days (a week now?) back about how to > check for writes past the end of the buffer, you would have been able > to spend your time today getting something done rather than wondering > why mprotect wasn't doing what you wanted.... > > Rich The worst thing is, I already do check that: I write '\r' in the last byte of the buffer, and then call the function saying the buffer is size-1 long (so it shows if it gets overwritten). It doesn't even make sense to test for reading/writing beyond size+1, except to test for implementation lunacy. I have no idea why I did that anymore. I should've just removed sigset altogether. I didn't need mprotect, nor wrappers... :-( P.S. Final buf.c thus won't look like the attached file. In it, alloc_bounded() is the broken one - a fixed version may appear somewhere else in the future though.