News for hackers. Stuff that matters.
Re:Heap-based buffer overflow in Sudo by saagarjha on Tuesday January 26, 2021 @07:10PM (#25922593)
Having written dictionary implementations in C, I would be very interested in seeing your implementation that fits in two dozen lines of code.
Re:Heap-based buffer overflow in Sudo by ddevault on Tuesday January 26, 2021 @07:25PM (#25922709)
Threw together an example (untested, with obvious errors) to give you an idea of what it could look like:

https://paste.sr.ht/~sircmpwn/3122d4a27a8e5312462e2329bf7ed6...

Actually managed to get it to exactly 2 dozen lines of code, not including the header, which isn't bad for an off-the-cuff remark.

You'd naturally expand or shrink this with whatever subset of map functions you require, like key/value enumeration, object deletion, resizing, whatever. It depends on your use-case. I don't believe in generic code.

Re:Heap-based buffer overflow in Sudo by saagarjha on Tuesday January 26, 2021 @07:46PM (#25922870)
Ok, that makes more sense. I was considering a slightly more fully-featured table and including the header (see: https://gist.github.com/saagarjha/00faa1963023206a8ccd987798...) and I was a couple times larger than your number, so I was trying to figure out what you were doing that I was unable to replicate…