* asn1_k_decode.c (asn1_decode_krb5_flags): Fix previous to
authorTom Yu <tlyu@mit.edu>
Fri, 4 Dec 1998 03:16:56 +0000 (03:16 +0000)
committerTom Yu <tlyu@mit.edu>
Fri, 4 Dec 1998 03:16:56 +0000 (03:16 +0000)
properly left-justify bit strings less than 32 bits.

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

src/lib/krb5/asn.1/ChangeLog
src/lib/krb5/asn.1/asn1_k_decode.c

index a3d98ad5f2841b0001d3fa488fe84e42a18787b0..52e04d26f9c7145f3f1236d323d321f3457b5c42 100644 (file)
@@ -1,5 +1,9 @@
 Thu Dec  3 19:41:06 1998  Tom Yu  <tlyu@mit.edu>
 
+
+       * asn1_k_decode.c (asn1_decode_krb5_flags): Fix previous to
+       properly left-justify bit strings less than 32 bits.
+
        * asn1_k_decode.c (asn1_decode_krb5_flags): Modify to deal with
        BIT STRING values that are not exactly 32 bits.  Throw away bits
        beyond number 31 in a bit string for now.  Deal with masking out
index 226b0443de0ac146e41669fda7edcf623f2d4f32..090fcc3d9394e9274b83747fa751f6f366b7d558 100644 (file)
@@ -298,8 +298,11 @@ asn1_error_code asn1_decode_krb5_flags(buf, val)
   }
   if (length <= 4) {
     /* Mask out unused bits, but only if necessary. */
-    f &= ~0 << unused;
+    f &= ~(krb5_flags)0 << unused;
   }
+  /* left-justify */
+  if (length < 4)
+    f <<= (4 - length) * 8;
   *val = f;
   return 0;
 }