[854] in Kerberos-V5-bugs
Re: appl/bsd patches....
daemon@ATHENA.MIT.EDU (Ken Raeburn)
Thu Oct 13 23:03:37 1994
From: Ken Raeburn <raeburn@cygnus.com>
Date: Thu, 13 Oct 1994 23:02:44 -0400
To: epeisach@MIT.EDU
Cc: krb5-bugs@MIT.EDU
In-Reply-To: epeisach@MIT.EDU's message of Thu, 13 Oct 1994 22:02:18 -0400 <9410140202.AA29363@kangaroo.mit.edu>
[excuse me, minor nitpick time]
From: epeisach@MIT.EDU
Date: Thu, 13 Oct 1994 22:02:18 -0400
krlogind.c:
magic is defined as an unsigned char array. cp is defined as a
char *. For some reason, the AXP 1.3 compiler screws up
the comparison in this case. (I suspect the 255 magic is
compared with -1 which is extended to something bigger).
The solution is to make cp
unsigned, but this requires that pibuf and fibuf be
unsigned as well. This is probably good as you generally
want to assume that the data over the wire is 8bits, not
7.
I disagree, slightly. The signedness shouldn't matter, as long as
it's consistent. Leaving it unspecified lets the host do sign- or
zero-extension, whichever is more convenient. (In fact, on many cpus
that can do byte comparisons, any compiler with a good optimizer
should simply not extend either value in this case, if the signedness
is made consistent.)
And if you're just pushing bytes around, again, the signedness
shouldn't matter.
The inconsistency is causing the problem you saw. The compiler didn't
screw up the comparison; some programmer did. The code really is
comparing a sign-extended (on the Alpha) byte value against a 255 int
value, and that just won't work.
I'm a bit surprised the problem didn't show up on other platforms...