From 98136e9e4221e53d4ad2de48695a7d3e82474a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Fri, 12 Dec 2003 12:32:50 +0000 Subject: [PATCH] make rrc a modulus operation if its longer then the length of the message git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13208 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/gssapi/cfx.c | 17 ++++++++--------- lib/gssapi/krb5/cfx.c | 17 ++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/lib/gssapi/cfx.c b/lib/gssapi/cfx.c index 4d25f8988..2034e5788 100644 --- a/lib/gssapi/cfx.c +++ b/lib/gssapi/cfx.c @@ -143,22 +143,21 @@ OM_uint32 _gssapi_wrap_size_cfx(OM_uint32 *minor_status, /* * Rotate "rrc" bytes to the front or back */ -static krb5_error_code rrc_rotate(void *data, - size_t len, - u_int16_t rrc, - krb5_boolean unrotate) + +static krb5_error_code +rrc_rotate(void *data, size_t len, u_int16_t rrc, krb5_boolean unrotate) { u_char *tmp; size_t left; char buf[256]; - if (rrc == 0) { + if (len == 0) return 0; - } - if (len < rrc) { - return ERANGE; - } + rrc %= len; + + if (rrc == 0) + return 0; left = len - rrc; diff --git a/lib/gssapi/krb5/cfx.c b/lib/gssapi/krb5/cfx.c index 4d25f8988..2034e5788 100644 --- a/lib/gssapi/krb5/cfx.c +++ b/lib/gssapi/krb5/cfx.c @@ -143,22 +143,21 @@ OM_uint32 _gssapi_wrap_size_cfx(OM_uint32 *minor_status, /* * Rotate "rrc" bytes to the front or back */ -static krb5_error_code rrc_rotate(void *data, - size_t len, - u_int16_t rrc, - krb5_boolean unrotate) + +static krb5_error_code +rrc_rotate(void *data, size_t len, u_int16_t rrc, krb5_boolean unrotate) { u_char *tmp; size_t left; char buf[256]; - if (rrc == 0) { + if (len == 0) return 0; - } - if (len < rrc) { - return ERANGE; - } + rrc %= len; + + if (rrc == 0) + return 0; left = len - rrc;