[Info-vax] Whither VMS?

JF Mezei jfmezei.spamnot at vaxination.ca
Mon Oct 5 23:46:52 EDT 2009


Re: C and buffer overflows.

Is there a language which keeps 2 values for each string: amount
allocated and amount currently in use ?

Without such 2 values, you can't have totally save "read" and "write"
into that variable. When you write, you need to know how many bytes you
can write, and when you read, you need to know how many bytes were
written to it.

Cobol had solved the problem by having fixed lenghth strings and when
you moved a shorter value to them, they would be padded to the fixed
length. (and you couldn't move longer values from within Cobol).

HOWEVER, when you called an externally compiled routine, that routine
would have no knowledge of the alloocated size of the variable you are
passing as argument so it could write beyond the buffer and cause problems.



More information about the Info-vax mailing list