sizeof(int) -> 4 bytes, because this is intended to be a portable
authorJohn Carr <jfc@mit.edu>
Sun, 23 Feb 1992 12:16:09 +0000 (12:16 +0000)
committerJohn Carr <jfc@mit.edu>
Sun, 23 Feb 1992 12:16:09 +0000 (12:16 +0000)
binary representation.

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

src/lib/kdb/decrypt_key.c

index 811727b3559c2f5deec0a37db88dd328dfdbb2b7..764b4eab9155ef6899a90f32a8b640931e06d3c5 100644 (file)
@@ -61,18 +61,17 @@ krb5_keyblock *out;
        out->length = 0;
        return ENOMEM;
     }
+
     /* copy out the real length count */
-    length  = ((unsigned char *)in->contents)[0] << 24;
-    length += ((unsigned char *)in->contents)[1] << 16;
-    length += ((unsigned char *)in->contents)[2] << 8;
-    length += ((unsigned char *)in->contents)[3];
-    out->length = length;
+    out->length  = (((unsigned char *)in->contents)[0] << 24)
+                + (((unsigned char *)in->contents)[1] << 16)
+                + (((unsigned char *)in->contents)[2] << 8)
+                +  ((unsigned char *)in->contents)[3];
 
-    /* remember the contents of the encrypted version has a sizeof(in->length)
+    /* remember the contents of the encrypted version has a 4 byte
        integer length of the real embedded key, followed by the
        encrypted key, so the offset here is needed */
-    if (retval = krb5_decrypt((krb5_pointer) (((char *) in->contents) +
-                                             sizeof(in->length)),
+    if (retval = krb5_decrypt((krb5_pointer) ((char *) in->contents + 4),
                              (krb5_pointer) out->contents,
                              in->length-sizeof(in->length), eblock, 0)) {
        xfree(out->contents);