[Info-vax] Whither VMS?
Bob Koehler
koehler at eisner.nospam.encompasserve.org
Mon Oct 5 10:25:25 EDT 2009
In article <ha6oek$gn9$02$1 at news.t-online.com>, Michael Kraemer <M.Kraemer at gsi.de> writes:
>
> That's not a problem of null termination,
> it's a problem of writing to an area you do not own.
It's a problem of the called routine having no way of preventing you
from writing to an area you do not own. Other languages do actually
prevent it.
> This may happen in any language, i.e.
> Assuming a fixed size of your data objects
> because it would never ever been exceeded
> (Y2K comes to mind).
> In C, one would have used sth like
> aBuffer = calloc( strlen(someString)+1, sizeof(*aBuffer) )
In Fortran, one would pass a string (CHARACTER), and the language
definition requires that the called function has access to the
allocated length of the buffer, although this is implemented
different ways by different compilers, and the function can prevent
the buffer from being overwritten.
>
> and it would be switched off for production release,
> where most of the buffer oflos would surface.
But functions in other languages can, and routinely do, block that
from happening using features that are not compile time selectable,
but instead are guarranteed by the language standard.
> That would be a compiler issue, not a language issue.
The C compiler is not required to pass the length by any part of the
C language standard, and I've never seen one that does, with the
possible exception of one that didn't sell.
>
> That would be an architecture issue, not a language issue.
It is a language issue. The C language standard could require the
allocated length to be passed, but it doesn't.
More information about the Info-vax
mailing list