Hi Jonathan -

On Wed, 12 Aug 2015 13:42:40 +0100, "Wilson, Jonathan"
<piercing_male@xxxxxxxxxxx> wrote:

But, the caller is the one setting up the "Data" to be returned and as
such I have no control over if this field is long enough, even if I were
to have extra parameters with say the length of the "Data" there is
nothing stopping the caller lying and, as far as I know, there is no
programmable way of finding out the definition (or at least its length)
of the field in the caller that was actually passed.

I agree with Mark ... it is the caller's responsibility to do things
right.

The same thing applies with the IBM APIs. If a caller lies to an IBM
API about the length of the output area for an API that loads output
into a caller-provided memory area, the API just takes it at its word.

I have written both APIs and procedures that work on the same
principle. It's my responsibility in writing the API or procedure to
make sure that I don't write beyond where I'm supposed to.

And it's my responsibility in writing the caller to make sure that I
provide sufficient area (if the length is pre-defined) or give the
API/procedure the correct length of the area (if the length is
caller-provided).

Ken
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.