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

John Reagan xyzzy1959 at gmail.com
Fri Mar 12 10:09:50 EST 2021


On Friday, March 12, 2021 at 8:38:09 AM UTC-5, Simon Clubley wrote:
> On 2021-03-12, Jim <mcki... 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.
For those of you keeping score at home, I checked the sources (Macro-32) and it seems to only deal with 32-bit descriptors.  Since the $SND* services use descriptors to describe non-strings, the internal consumers would also need to handle 64-bit addresses and/or lengths > 64K.  I guess it is the 64-bit addresses that is the "most common" request (ie, this thread).   I think we can deliver this change at the same time we ship object-oriented BASIC.




More information about the Info-vax mailing list