Fix a precedence error in g_make_token_header() which caused it to
authorGreg Hudson <ghudson@mit.edu>
Fri, 25 Mar 2011 15:50:06 +0000 (15:50 +0000)
committerGreg Hudson <ghudson@mit.edu>
Fri, 25 Mar 2011 15:50:06 +0000 (15:50 +0000)
write the wrong length when no token type is passed.

(From r24739 in users/lhoward/moonshot-mechglue-fixes.)

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24745 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/generic/util_token.c

index 3acbd8e6a6f5b0052a761c97814f8b9770503e06..0c4c90c16e5237d5f916910fd34ce9f2b1291119 100644 (file)
@@ -133,7 +133,7 @@ unsigned int
 g_token_size(const gss_OID_desc * mech, unsigned int body_size)
 {
     /* set body_size to sequence contents size */
-    body_size += 4 + (int) mech->length;         /* NEED overflow check */
+    body_size += 4 + (unsigned int)mech->length;         /* NEED overflow check */
     return(1 + der_length_size(body_size) + body_size);
 }
 
@@ -148,7 +148,7 @@ g_make_token_header(
     int tok_type)
 {
     *(*buf)++ = 0x60;
-    der_write_length(buf, (tok_type == -1) ?2:4 + mech->length + body_size);
+    der_write_length(buf, ((tok_type == -1) ? 2 : 4) + mech->length + body_size);
     *(*buf)++ = 0x06;
     *(*buf)++ = (unsigned char) mech->length;
     TWRITE_STR(*buf, mech->elements, mech->length);