[2524] in Kerberos_V5_Development
Re: Should realm's be NULL terminated...
daemon@ATHENA.MIT.EDU (Marc Horowitz)
Mon Oct 6 15:48:29 1997
To: epeisach@MIT.EDU
Cc: krbdev@MIT.EDU
From: Marc Horowitz <marc@cygnus.com>
Date: 06 Oct 1997 15:46:13 -0400
In-Reply-To: epeisach@MIT.EDU's message of Mon, 6 Oct 1997 12:16:05 -0400
epeisach@MIT.EDU writes:
>> If I am reading the code correctly, most of the realm parsing code in
>> the krb5 library allocate space for a NULL after the realm string, but
>> set the length not to include that null.
<anal>
NUL is a 0 character. NULL is a zero pointer.
</anal>
>> Is this what is desired? Does anything make assumptions about this?
>> The reason I as is that in set_realm.c, the realm is set using strcpy
>> into space malloced as strlen(string) - i.e. off by one.
>>
>> Should I allocate one more byte, or use memcpy?
>>
>> Personally, I believe memcpy would be the proper fix...
I agree. At one point, the realm was NUL-terminated, but this was
changed (around b6 I think) to length/data. If something is still
confused, fix it.
Marc