[Info-vax] Whither VMS?

Richard B. Gilbert rgilbert88 at comcast.net
Tue Oct 6 08:41:13 EDT 2009


JF Mezei wrote:
> 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.

I don't know of such a language.  I think you will have to "roll your 
own" string descriptors!  You could write your own library of string 
functions using your own descriptors.  Or you could just borrow the 
facility that's already there in DEC C.



More information about the Info-vax mailing list