summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-12-15 11:38:56 -0500
committerSimo Sorce <simo@redhat.com>2015-03-24 11:46:39 -0400
commitaa4fc60117a35a56735fdca533d0169c9c5f76d0 (patch)
treeec031bd479e8fb8dffa698467ca5cc9c31ed2747
parent785889ad666a67525cbd73d1b098dd53b4cdfc18 (diff)
downloadgss-proxy-aa4fc60117a35a56735fdca533d0169c9c5f76d0.tar.gz
gss-proxy-aa4fc60117a35a56735fdca533d0169c9c5f76d0.tar.xz
gss-proxy-aa4fc60117a35a56735fdca533d0169c9c5f76d0.zip
Fix cast error
An unsigned int cannot be cast to a size_t. On some architectures (like s390) they have different sizes resulting in both writing out of bounds and getting just a zero in the length field and causing the next operation to fail. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Nathaniel McCallum <npmccallum@redhat.com> Reviewed-by: Roland Mainz <rmainz@redhat.com>
-rw-r--r--proxy/src/gp_export.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/proxy/src/gp_export.c b/proxy/src/gp_export.c
index b855c74..341ef0a 100644
--- a/proxy/src/gp_export.c
+++ b/proxy/src/gp_export.c
@@ -113,6 +113,7 @@ static int gp_encrypt_buffer(krb5_context context, krb5_keyblock *key,
int ret;
krb5_data data_in;
krb5_enc_data enc_handle;
+ size_t cipherlen;
data_in.length = len;
data_in.data = buf;
@@ -122,11 +123,12 @@ static int gp_encrypt_buffer(krb5_context context, krb5_keyblock *key,
ret = krb5_c_encrypt_length(context,
GP_CREDS_HANDLE_KEY_ENCTYPE,
data_in.length,
- (size_t *)&enc_handle.ciphertext.length);
+ &cipherlen);
if (ret) {
goto done;
}
+ enc_handle.ciphertext.length = cipherlen;
enc_handle.ciphertext.data = malloc(enc_handle.ciphertext.length);
if (!enc_handle.ciphertext.data) {
ret = ENOMEM;