overmalloc_safe_strcpy?

Andrew Bartlett abartlet at samba.org
Tue Mar 18 05:23:45 GMT 2003


On Tue, Mar 18, 2003 at 04:11:23PM +1100, Martin Pool wrote:
> For developer mode, this seems to be the same as safe_strcpy: we
> clobber the specified region at runtime.  Otherwise, it skips the
> static CHECK_STRING_SIZE call.
> 
> I think this is meant to allow you to call it passing the address of
> an array whose size is less than the maxlength passed to safe_strcpy.
> CHECK_STRING_SIZE would normally trap on this because it expects
> either a string pointer, or an exact fit?
> 
> Is that right?  If so I'll add a comment to this effect -- and perhaps
> a plea not to use it in new code.

Correct.  The only user is nmbd now - because I changed the stat cache
to use pointers into the overmalloc()ed buffer.  

It's a pity that we can't tell what's behind a pointer, but it's a 
start. :-)

Andrew Bartlett


More information about the samba-technical mailing list