diff options
author | Simon Josefsson <simon@josefsson.org> | 2007-08-16 12:56:11 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2007-08-16 12:56:11 +0200 |
commit | 323d3630fb7f8c2872271761ec8fe0b6e4535d55 (patch) | |
tree | f3ac10df877f9b2c3daf0fff145b75d9e1a3e76a | |
parent | 6ef83a6207c085902ae2af15c02f520a23e0bea3 (diff) | |
download | gnutls-323d3630fb7f8c2872271761ec8fe0b6e4535d55.tar.gz |
Fix pointer mix for different sized variables.
Tiny patch from <http://cvs.fedora.redhat.com/viewcvs/devel/gnutls/gnutls-1.6.3-incompat-pointers.patch?rev=1.1&view=auto>.
-rw-r--r-- | lib/auth_psk_passwd.c | 8 | ||||
-rw-r--r-- | lib/gnutls_psk.c | 8 | ||||
-rw-r--r-- | lib/gnutls_x509.c | 4 | ||||
-rw-r--r-- | libextra/gnutls_openpgp.c | 7 | ||||
-rw-r--r-- | libextra/openssl_compat.c | 8 |
5 files changed, 23 insertions, 12 deletions
diff --git a/lib/auth_psk_passwd.c b/lib/auth_psk_passwd.c index a82ade6a23..0e4ec44ce7 100644 --- a/lib/auth_psk_passwd.c +++ b/lib/auth_psk_passwd.c @@ -48,6 +48,7 @@ pwd_put_values (gnutls_datum_t * psk, char *str) { char *p; int len, ret; + size_t size; p = strchr (str, ':'); if (p == NULL) @@ -68,15 +69,16 @@ pwd_put_values (gnutls_datum_t * psk, char *str) if (p[len - 1] == '\n' || p[len - 1] == ' ') len--; - psk->size = len / 2; - psk->data = gnutls_malloc (psk->size); + size = psk->size = len / 2; + psk->data = gnutls_malloc (size); if (psk->data == NULL) { gnutls_assert (); return GNUTLS_E_MEMORY_ERROR; } - ret = _gnutls_hex2bin ((opaque *) p, len, psk->data, &psk->size); + ret = _gnutls_hex2bin ((opaque *) p, len, psk->data, &size); + psk->size = (unsigned int)size; if (ret < 0) { gnutls_assert (); diff --git a/lib/gnutls_psk.c b/lib/gnutls_psk.c index a6be1a5e05..ace9b47704 100644 --- a/lib/gnutls_psk.c +++ b/lib/gnutls_psk.c @@ -119,8 +119,9 @@ gnutls_psk_set_client_credentials (gnutls_psk_client_credentials_t res, } else { /* HEX key */ - res->key.size = key->size / 2; - res->key.data = gnutls_malloc (res->key.size); + size_t size; + size = res->key.size = key->size / 2; + res->key.data = gnutls_malloc (size); if (res->key.data == NULL) { gnutls_assert (); @@ -128,7 +129,8 @@ gnutls_psk_set_client_credentials (gnutls_psk_client_credentials_t res, goto error; } - ret = gnutls_hex_decode (key, (char *) res->key.data, &res->key.size); + ret = gnutls_hex_decode (key, (char *) res->key.data, &size); + res->key.size = (unsigned int)size; if (ret < 0) { gnutls_assert (); diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index b07d4473b4..68e574ce0e 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -1893,6 +1893,7 @@ gnutls_certificate_set_x509_simple_pkcs12_file gnutls_x509_crt_t cert = NULL; gnutls_x509_crl_t crl = NULL; int ret; + size_t size; ret = gnutls_pkcs12_init (&p12); if (ret < 0) @@ -1901,7 +1902,8 @@ gnutls_certificate_set_x509_simple_pkcs12_file return ret; } - p12blob.data = read_binary_file (pkcs12file, &p12blob.size); + p12blob.data = read_binary_file (pkcs12file, &size); + p12blob.size = (unsigned int)size; if (p12blob.data == NULL) { gnutls_assert (); diff --git a/libextra/gnutls_openpgp.c b/libextra/gnutls_openpgp.c index 458946f3ec..d07df0cb78 100644 --- a/libextra/gnutls_openpgp.c +++ b/libextra/gnutls_openpgp.c @@ -726,6 +726,7 @@ gnutls_certificate_set_openpgp_key_file (gnutls_certificate_credentials_t struct stat statbuf; gnutls_datum_t key, cert; int rc; + size_t size; if (!res || !keyfile || !certfile) { @@ -739,14 +740,16 @@ gnutls_certificate_set_openpgp_key_file (gnutls_certificate_credentials_t return GNUTLS_E_FILE_ERROR; } - cert.data = read_binary_file (certfile, &cert.size); + cert.data = read_binary_file (certfile, &size); + cert.size = (unsigned int)size; if (cert.data == NULL) { gnutls_assert (); return GNUTLS_E_FILE_ERROR; } - key.data = read_binary_file (keyfile, &key.size); + key.data = read_binary_file (keyfile, &size); + key.size = (unsigned int)size; if (key.data == NULL) { gnutls_assert (); diff --git a/libextra/openssl_compat.c b/libextra/openssl_compat.c index f28c84d2b1..31d1f48470 100644 --- a/libextra/openssl_compat.c +++ b/libextra/openssl_compat.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation + * Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -537,6 +537,7 @@ gnutls_x509_extract_certificate_dn_string (char *buf, { gnutls_x509_crt_t xcert; int result; + size_t size; result = gnutls_x509_crt_init (&xcert); if (result < 0) @@ -549,10 +550,11 @@ gnutls_x509_extract_certificate_dn_string (char *buf, return result; } + size = sizeof_buf; if (!issuer) - result = gnutls_x509_crt_get_dn (xcert, buf, &sizeof_buf); + result = gnutls_x509_crt_get_dn (xcert, buf, &size); else - result = gnutls_x509_crt_get_issuer_dn (xcert, buf, &sizeof_buf); + result = gnutls_x509_crt_get_issuer_dn (xcert, buf, &size); gnutls_x509_crt_deinit (xcert); |