From be58b2e6664389d9c7993b55291402934b43b3ca Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 24 Aug 2017 15:49:50 +0200 Subject: [PATCH] Accept a NULL pointer for the padded length in sodium_pad() --- src/libsodium/sodium/utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libsodium/sodium/utils.c b/src/libsodium/sodium/utils.c index 8f5a932a..f13938c4 100644 --- a/src/libsodium/sodium/utils.c +++ b/src/libsodium/sodium/utils.c @@ -648,7 +648,9 @@ sodium_pad(size_t *padded_buflen_p, unsigned char *buf, return -1; } tail = &buf[xpadded_len]; - *padded_buflen_p = xpadded_len + 1U; + if (padded_buflen_p != NULL) { + *padded_buflen_p = xpadded_len + 1U; + } mask = 0U; for (i = 0; i < blocksize; i++) { barrier_mask = (unsigned char) (((i ^ xpadlen) - 1U) >> 8);