gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: util: Add overflow check to GNUNET_CRYPT


From: gnunet
Subject: [gnunet] branch master updated: util: Add overflow check to GNUNET_CRYPTO_FileHashContext. Fixes #9302
Date: Tue, 29 Oct 2024 13:00:09 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 663478b6b util: Add overflow check to GNUNET_CRYPTO_FileHashContext. 
Fixes #9302
663478b6b is described below

commit 663478b6b6571b3c7a2260fb4d0b76da93561936
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Oct 29 12:59:41 2024 +0100

    util: Add overflow check to GNUNET_CRYPTO_FileHashContext. Fixes #9302
---
 src/lib/util/crypto_hash_file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lib/util/crypto_hash_file.c b/src/lib/util/crypto_hash_file.c
index b149bd280..7af86a8d8 100644
--- a/src/lib/util/crypto_hash_file.c
+++ b/src/lib/util/crypto_hash_file.c
@@ -175,8 +175,9 @@ GNUNET_CRYPTO_hash_file (enum GNUNET_SCHEDULER_Priority 
priority,
   struct GNUNET_CRYPTO_FileHashContext *fhc;
 
   GNUNET_assert (blocksize > 0);
+  GNUNET_assert (blocksize <= (SIZE_MAX - sizeof (*fhc)));
   fhc =
-    GNUNET_malloc (sizeof(struct GNUNET_CRYPTO_FileHashContext) + blocksize);
+    GNUNET_malloc (sizeof(*fhc) + blocksize);
   fhc->callback = callback;
   fhc->callback_cls = callback_cls;
   fhc->buffer = (unsigned char *) &fhc[1];

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]