On Sat, 10 Jun 2006, Michael J. Mahon wrote:
For over a decade I have preached to anyone who would listen that the
biggest design error in C is its use of null-terminated strings. This
inherently insecure data representation makes unsafe programming easy
and safe programming harder.
Security demands that *all* data moves into fixed space handle the case
where the data does not fit. Yet programmers seduced by the "cuteness"
of null-termination argue against fixing this no-brainer security lapse.
Count-prefixed strings can also be very efficiently implemented, as can
count-controlled move loops for null-terminated strings (the obvious fix
for C).
I'd like to suggest that perhaps an alternate runtime library for C can
be coded on a few systems, "libnewc" perhaps, that includes, among other
things, better ways of handling strings. C's mechanism is very limited
and the null termination thing doesn't help.