From d01e1f48754f9514be922d70f51b141a4be2c899 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 15 Aug 2014 15:10:24 -0700 Subject: [PATCH] On error path, do not set the signature len if a NULL pointer was given. --- src/libsodium/crypto_sign/ed25519/ref10/sign.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libsodium/crypto_sign/ed25519/ref10/sign.c b/src/libsodium/crypto_sign/ed25519/ref10/sign.c index c56367df..008b5c2a 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/sign.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/sign.c @@ -63,7 +63,9 @@ crypto_sign(unsigned char *sm, unsigned long long *smlen, if (crypto_sign_detached(sm, &siglen, m, mlen, sk) != 0 || siglen > crypto_sign_ed25519_BYTES) { - *smlen = 0; + if (smlen != NULL) { + *smlen = 0; + } memset(sm, 0, mlen + crypto_sign_ed25519_BYTES); return -1; }