diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-11-28 23:59:53 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-12-06 08:59:01 +0100 |
commit | 85ca8cbd96708816d6b3e01191ce60622be179bf (patch) | |
tree | a5c9a936c449794d982129d16369f8a11d2fde22 | |
parent | 518f9a14fd2264ee859ab05fda0706039bf8dec0 (diff) | |
download | gnutls-85ca8cbd96708816d6b3e01191ce60622be179bf.tar.gz |
_gnutls_strdatum_to_buf() will account for NULL input.
-rw-r--r-- | lib/x509/common.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c index 594ad0f725..02f9fdacf4 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -1760,21 +1760,21 @@ error: * * The buffer will always be null terminated. */ -int _gnutls_strdatum_to_buf (gnutls_datum_t * d, void* buf, size_t * sizeof_buf) +int _gnutls_strdatum_to_buf (gnutls_datum_t * d, void* buf, size_t * buf_size) { int ret; uint8_t *_buf = buf; - if (*sizeof_buf < d->size+1) + if (buf == NULL || *buf_size < d->size+1) { - *sizeof_buf = d->size+1; + *buf_size = d->size+1; ret = gnutls_assert_val(GNUTLS_E_SHORT_MEMORY_BUFFER); goto cleanup; } memcpy(buf, d->data, d->size); _buf[d->size] = 0; - *sizeof_buf = d->size; + *buf_size = d->size; ret = 0; cleanup: |