* kcmd.c (v4_des_write): Apply patch from ghudson to fix
authorTom Yu <tlyu@mit.edu>
Fri, 31 Jan 2003 05:50:29 +0000 (05:50 +0000)
committerTom Yu <tlyu@mit.edu>
Fri, 31 Jan 2003 05:50:29 +0000 (05:50 +0000)
non-right-justification case.

ticket: 620

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

src/appl/bsd/ChangeLog
src/appl/bsd/kcmd.c

index abbabbae7f46e6351da0f5d1ec601c7b449c18fe..41f3e70bba6af9919dc229ad729da712fbde6d9b 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-31  Tom Yu  <tlyu@mit.edu>
+
+       * kcmd.c (v4_des_write): Apply patch from ghudson to fix
+       non-right-justification case.
+
 2003-01-30  Ken Raeburn  <raeburn@mit.edu>
 
        * login.c (try_krb4): Delete unused krb5 principal name argument.
index 6bd4aeea7d3376106346575f47418fe98377da24..5388e7a7b2aa37d5b9459e16ce7dabb52de6be81 100644 (file)
@@ -1251,10 +1251,15 @@ int secondary;
 #endif
 #define min(a,b) ((a < b) ? a : b)
 
-       if (len < 8 && right_justify) {
-               krb5_random_confounder(8 - len, garbage_buf);
-               /* this "right-justifies" the data in the buffer */
-               (void) memcpy(garbage_buf + 8 - len, buf, len);
+       if (len < 8) {
+               if (right_justify) {
+                       krb5_random_confounder(8 - len, garbage_buf);
+                       /* this "right-justifies" the data in the buffer */
+                       (void) memcpy(garbage_buf + 8 - len, buf, len);
+               } else {
+                       krb5_random_confounder(8 - len, garbage_buf + len);
+                       (void) memcpy(garbage_buf, buf, len);
+               }
        }
        (void) pcbc_encrypt((des_cblock *) ((len < 8) ? garbage_buf : buf),
                            (des_cblock *) (des_outpkt+4),