Replies (3)

yes it can be a total Brain Fuck, and fuck you over for countless hours but that's how you develop 1) a thick skin for shit tolerance 2) A ton of patience 3) Discipline
Yes, classical C has the problem that operations are low-level, so if you overrun the end of a buffer, instead of a crash report the attacker can make arbitrary commands run. Also, manually deallocating memory can be omitted (oops, program grows over time, crashes) or done twice (also classically tricked into running arbitrary code). Also, the standard routines are minimal, forcing programmers generally to deal with these issues everywhere. CLN has a *lot* of internal infrastructure to avoid code having to do this. Firstly, the tal hierarchical allocator removes most manual deallocating, and all the infrastructure relies on it. Second, all the wire demarshaling routines are generated from spec files, and all come down to two hard-to-misuse routines (note: the bolt11 parsing was hand-coded by me, didn't use this, and had serious bugs!). Finally, we use patterns designed to highlight issues early, including running test cases under Valgrind (a memory debugger) and internal memory leak detection. But as one developer said "It's not coding in C, it's coding in Rusty's C"!