IETF-SSH archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: define string
Glenn McGrath <bug1%optushome.com.au@localhost> wrote:
> By trying to talk to openssh and lsh servers i worked out a string is
>
> char string_length
> char *string
> char extra_terminators[3]
>
> I understand why string_length is there, its can make it easier to
> handle the string, but why are there three extra '\0' terminators ?
>
> Irrespective of the reasoning i think the format of the string should be
> documented somewhere
It is. Look in draft-ietf-secsh-architecture-13.txt, which contains
general material which applies to more than one of the transport,
userauth and connect drafts:
string
Arbitrary length binary string. Strings are allowed to
contain arbitrary binary data, including null characters and
8-bit characters. They are stored as a uint32 containing its
length (number of bytes that follow) and zero (= empty string)
or more bytes that are the value of the string. Terminating
null characters are not used.
Strings are also used to store text. In that case, US-ASCII
is used for internal names, and ISO-10646 UTF-8 for text that
might be displayed to the user. The terminating null
character SHOULD NOT normally be stored in the string.
For example, the US-ASCII string "testing" is represented as
00 00 00 07 t e s t i n g. The UTF8 mapping does not alter
the encoding of US-ASCII characters.
In other words, your `three extra terminators' are actually part of
the 32-bit length field of the _next_ string.
Hope that helps,
Simon
--
Simon Tatham "Thieves respect property; they only wish the property to
<anakin%pobox.com@localhost> be their own, that they may more properly respect it."
Home |
Main Index |
Thread Index |
Old Index