At 11:33 AM 6/1/98 -0700, Jon Callas wrote:
At 11:57 PM 5/29/98 -0700, Bill Stewart wrote:
Null-terminating the string would be a nice touch; it's not necessary,
since there's a length field, but it would probably reduce accidents,
and it also makes it convenient for tools such as "strings" to find.
With counted strings, someone has to go and terminate them anyway, and the
only place where a null-terminated string is specified in the whole draft
is in the regular expression subpacket (and I don't know why it's there).
When I put on my developer's hat, I look at it and think that I'd write to
code to look at the length of the subpacket, and if it's greater than 1,
then I have text. If the string is null-terminated, how do I handle the
bizarre case of a specified comment that is a null string? Do I treat it
the same as no specified string, or as a blank comment? There's an easy
answer (treat it as no comment), but the question goes away if we just use
The "yes, that \0 in the middle of the string is part of the comment" case
does seem to make null-terminating a less-than-good idea.
My concern was the number of times I've seen C programmers assume
null-terminated strings and read past the end, even if they've got
a length count.
Bill Stewart, bill(_dot_)stewart(_at_)pobox(_dot_)com
PGP Fingerprint D454 E202 CBC8 40BF 3C85 B884 0ABE 4639