diff options
author | Theodore Tso <tytso@mit.edu> | 1999-04-23 04:33:19 +0000 |
---|---|---|
committer | Theodore Tso <tytso@mit.edu> | 1999-04-23 04:33:19 +0000 |
commit | 03c8dc0b570c38d17ba78e4de7fd13bde86a3df3 (patch) | |
tree | f155eedbb29ee2522a33c46fdaaa9cc7f07c113e /src/lib/gssapi | |
parent | 3c295bf54be08b81b8b45c96fc65bdc87f88a771 (diff) | |
download | krb5-03c8dc0b570c38d17ba78e4de7fd13bde86a3df3.tar.gz krb5-03c8dc0b570c38d17ba78e4de7fd13bde86a3df3.tar.xz krb5-03c8dc0b570c38d17ba78e4de7fd13bde86a3df3.zip |
wrap_size_limit.c (krb5_gss_wrap_size_limit): Fix wrap_size limit so
that it correctly calculates its results, and underestimates the
correct size instead of overestimating it, and not returning zero all
the time. (Which it used to do after the March 25 fix.)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11380 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/gssapi')
-rw-r--r-- | src/lib/gssapi/krb5/ChangeLog | 8 | ||||
-rw-r--r-- | src/lib/gssapi/krb5/wrap_size_limit.c | 18 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 61b9cb5861..dbab40a0c8 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,3 +1,11 @@ +Fri Apr 23 00:31:17 1999 Theodore Y. Ts'o <tytso@mit.edu> + + * wrap_size_limit.c (krb5_gss_wrap_size_limit): Fix wrap_size + limit so that it correctly calculates its results, and + underestimates the correct size instead of overestimating + it, and not returning zero all the time. (Which it used + to do after the March 25 fix.) + Sat Apr 17 01:23:57 1999 Theodore Y. Ts'o <tytso@mit.edu> * gssapi_krb5.h, copy_ccache.c, get_tkt_flags.c, set_ccache.c: diff --git a/src/lib/gssapi/krb5/wrap_size_limit.c b/src/lib/gssapi/krb5/wrap_size_limit.c index 54c29da306..f7fee73cdf 100644 --- a/src/lib/gssapi/krb5/wrap_size_limit.c +++ b/src/lib/gssapi/krb5/wrap_size_limit.c @@ -150,21 +150,27 @@ krb5_gss_wrap_size_limit(minor_status, context_handle, conf_req_flag, *max_input_size = req_output_size - headerlen; } } else { - OM_uint32 cfsize; + OM_uint32 data_size, conflen; OM_uint32 ohlen; + int overhead; /* Calculate the token size and subtract that from the output size */ - cfsize = (conf_req_flag) ? kg_confounder_size(context, ctx->enc) : 0; + overhead = 7 + ctx->mech_used->length; + data_size = req_output_size; + if (conf_req_flag) { + conflen = kg_confounder_size(context, ctx->enc); + data_size = (conflen + data_size + 8) & (~7); + } ohlen = g_token_size((gss_OID) ctx->mech_used, - (unsigned int) (req_output_size + cfsize + - ctx->cksum_size + 14)); + (unsigned int) (data_size + ctx->cksum_size + 14)) + - req_output_size; - if (ohlen < req_output_size) + if (ohlen+overhead < req_output_size) /* * Cannot have trailer length that will cause us to pad over * our length */ - *max_input_size = (req_output_size - ohlen - 1) & (~7); + *max_input_size = (req_output_size - ohlen - overhead) & (~7); else *max_input_size = 0; } |