diff options
author | Simo Sorce <simo@redhat.com> | 2014-12-15 11:38:56 -0500 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2015-03-21 14:25:26 -0400 |
commit | 6555dbe148c4f682fe939f329b1a7fcb805ee339 (patch) | |
tree | ec031bd479e8fb8dffa698467ca5cc9c31ed2747 | |
parent | 7190829be2814269463dd91cbb480d4585fcae6c (diff) | |
download | gss-proxy-6555dbe148c4f682fe939f329b1a7fcb805ee339.tar.gz gss-proxy-6555dbe148c4f682fe939f329b1a7fcb805ee339.tar.xz gss-proxy-6555dbe148c4f682fe939f329b1a7fcb805ee339.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>
-rw-r--r-- | proxy/src/gp_export.c | 4 |
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; |