From 50501b43418d5fee8c53c3f12bb2cb867bccb967 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Fri, 31 Jan 2003 05:50:29 +0000 Subject: [PATCH] * kcmd.c (v4_des_write): Apply patch from ghudson to fix 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 | 5 +++++ src/appl/bsd/kcmd.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index abbabbae7..41f3e70bb 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,8 @@ +2003-01-31 Tom Yu + + * kcmd.c (v4_des_write): Apply patch from ghudson to fix + non-right-justification case. + 2003-01-30 Ken Raeburn * login.c (try_krb4): Delete unused krb5 principal name argument. diff --git a/src/appl/bsd/kcmd.c b/src/appl/bsd/kcmd.c index 6bd4aeea7..5388e7a7b 100644 --- a/src/appl/bsd/kcmd.c +++ b/src/appl/bsd/kcmd.c @@ -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), -- 2.26.2