[Info-vax] $sndopr() and dsc64$descriptor

Simon Clubley clubley at remove_me.eisner.decus.org-Earth.UFP
Fri Mar 12 08:38:06 EST 2021


On 2021-03-12, Jim <mckinneyj at leidos.com> wrote:
> On Thursday, March 11, 2021 at 1:55:39 PM UTC-5, Stephen Hoffman wrote:
>> On 2021-03-11 18:32:07 +0000, Jim said: 
>> 
>> > _strcpy32((__char_ptr32)&reply.opc$l_ms_text, message); 
>> > 
>> > length = strlen((__char_ptr32)&reply.opc$l_ms_text);
>> While that's not specifically introducing a bug, use of that sequence 
>> elsewhere can be Bad.
>
> Yes, C string functions that rely on null termination can be unsafe. Alternatives such as the VMS STR$ RTL routines or even the "n" variants of the C string functions would be better choices for production code.

And don't forget that strncpy() may not actually terminate the copied
string. :-)

Simon.

-- 
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.



More information about the Info-vax mailing list