3 ms·
Ok so it removes the C surface of attack, but does it not introduce the Go one? What makes it superior when it comes to security?
by varispeed 6y ago
Ok so it removes the C surface of attack, but does it not introduce the Go one? What makes it superior when it comes to security?
- pjmlp 6y agoFor starters: - Bounds checking for strings and arrays - Proper strings - No implicit type conversions - Unsafe code requires use of unsafe package, thus very easy to track down in code reviews - No need for pointer arithmetic everywhere, using fat pointers instead (slices) - For "generic" code interface{} is type safe, whereas void* can be anything - No use-after-free thanks GC
- varispeed 6y agoThank you! Are you aware of any surfaces of attack against Go that do no exist in C?
- pjmlp 6y agoOnly stuff that might exploit bugs in the standard library, or runtime implementation. As everything, even formal specification based languages might have logical bugs in them. What C gets on top of that are memory corruption bugs and optimization bugs caused by optimizers taking advantage of UB. Naturally that can also happen in unsafe code blocks in other languages, the big difference in C is due to its strings and arrays, almost every line of code manipulates pointers without bounds checking, and exploits ensue.