[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: fail nicely if encoded text would be way
From: |
gnunet |
Subject: |
[gnunet] branch master updated: fail nicely if encoded text would be way too large |
Date: |
Sun, 18 Jul 2021 14:54:42 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 24433cf8d fail nicely if encoded text would be way too large
24433cf8d is described below
commit 24433cf8d1241991b5a264ef81dc26868b50b90e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jul 18 14:51:32 2021 +0200
fail nicely if encoded text would be way too large
---
src/json/json_generator.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/json/json_generator.c b/src/json/json_generator.c
index 5806eb174..0c513ca9d 100644
--- a/src/json/json_generator.c
+++ b/src/json/json_generator.c
@@ -42,7 +42,14 @@ GNUNET_JSON_from_data (const void *data,
char *buf;
json_t *json;
- buf = GNUNET_STRINGS_data_to_string_alloc (data, size);
+ if ((size * 8 + 4) / 5 + 1 >=
+ GNUNET_MAX_MALLOC_CHECKED)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ buf = GNUNET_STRINGS_data_to_string_alloc (data,
+ size);
json = json_string (buf);
GNUNET_free (buf);
GNUNET_break (NULL != json);
@@ -201,5 +208,4 @@ GNUNET_JSON_from_rsa_signature (const struct
GNUNET_CRYPTO_RsaSignature *sig)
}
-
/* End of json/json_generator.c */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: fail nicely if encoded text would be way too large,
gnunet <=