C's pointers wouldn't be an issue if the world had used the Intel iAPX 432 processor instead of the 8086. The iAPX 432 included bounds checking for every array in hardware (among many other features), so it was impossible to make an out-of-bounds access.
Unfortunately the iPAX 432 was delayed, so Intel introduced the 8086 as a stopgap processor and computers have been using the x86 architecture ever since. It's interesting to think that if history had gone a bit differently, whole classes of security problems would not exist.
> so it was impossible to make an out-of-bounds access.
That's a strong claim for something as vaguely defined as "the length of an array."
What if I allocate a huge array of memory and emulate another processor using that memory? What if I subpartition an array? What if I overallocate an array to avoid reallocations?
C-the-language has no concept of size-tagged arrays at runtime, and I guess it's baked in deeply due to the various guarantees made about sizeof(array), &array[0], and ability to cast &array[0] back to the original array. The iAPX hardware would have gone unused
Unfortunately the iPAX 432 was delayed, so Intel introduced the 8086 as a stopgap processor and computers have been using the x86 architecture ever since. It's interesting to think that if history had gone a bit differently, whole classes of security problems would not exist.
https://en.wikipedia.org/wiki/Intel_iAPX_432