diff options
author | Nikos Mavrogiannopoulos <nmav@crystal.(none)> | 2009-01-27 22:53:04 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@crystal.(none)> | 2009-01-27 22:58:08 +0200 |
commit | cf37265a682c9f14470147ab22828173433f77df (patch) | |
tree | 8f623ef89301a3966e3d417b8a1d0fa9bceb7190 | |
parent | 4836a00d05dece684b695959e12d96a55ed8c141 (diff) | |
download | gnutls-cf37265a682c9f14470147ab22828173433f77df.tar.gz |
result_size in gnutls_hex_encode behaves as documented. It now holds the size of the result. Reported by John Brooks.
-rw-r--r-- | lib/gnutls_psk.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gnutls_psk.c b/lib/gnutls_psk.c index f629fa6f14..6c66bbe2c6 100644 --- a/lib/gnutls_psk.c +++ b/lib/gnutls_psk.c @@ -407,14 +407,17 @@ int gnutls_hex_encode (const gnutls_datum_t * data, char *result, size_t * result_size) { - if (*result_size < data->size + data->size + 1) +size_t res = data->size + data->size + 1; + + if (*result_size < res) { gnutls_assert (); return GNUTLS_E_SHORT_MEMORY_BUFFER; } _gnutls_bin2hex (data->data, data->size, result, *result_size); - + *result_size = res; + return 0; } |