On Wed, 2007-08-22 at 15:04 -0500, [EMAIL PROTECTED] wrote:

>  > If only strlen(refhost) bytes are copied from refhost then they don't
>  > include the terminating null. It should strlen(refhost) + 1, or strcpy
>  > should be used. 
>  > 
>  > A rebuilt 2.2.1 with the patch from the '2.2.1 broken HostRange again?'
>  > thread on Mon Jun 25 21:51:47 CEST 2007 which worked yesterday stopped
>  > working today. It was when I saw strange characters in the debug output
>  > that I suspected what I found.
> 
> Can you reproduce this behavior? Have you verified that 
> using strcpy() works for you??

Yes.

> It seems that both refbase and refhost are CF_MAXVARSIZE 
> in size and and refhost is guaranteed to be null terminated.

refhost may be, but the problem is that refbase isn't. sp could be
pointing anywhere after these two statements:

strncpy(refbase,refhost,strlen(refhost));
sp = refbase + strlen(refbase) - 1;

Printing strlen(refbase) after the copy gives numbers that are not
always the length of the hostname.

Jim


_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to