aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/json/json_helper.c11
-rw-r--r--src/util/gnunet-base32.c14
2 files changed, 18 insertions, 7 deletions
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 6189b7596..03db9ec80 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -125,7 +125,7 @@ parse_variable_data (void *cls,
125 return GNUNET_SYSERR; 125 return GNUNET_SYSERR;
126 } 126 }
127 size = (strlen (str) * 5) / 8; 127 size = (strlen (str) * 5) / 8;
128 if (size >= 1024) 128 if (size >= GNUNET_MAX_MALLOC_CHECKED)
129 { 129 {
130 GNUNET_break_op (0); 130 GNUNET_break_op (0);
131 return GNUNET_SYSERR; 131 return GNUNET_SYSERR;
@@ -135,6 +135,15 @@ parse_variable_data (void *cls,
135 strlen (str), 135 strlen (str),
136 data, 136 data,
137 size); 137 size);
138 if ( (0 < size) &&
139 (GNUNET_OK != res) )
140 {
141 size--;
142 res = GNUNET_STRINGS_string_to_data (str,
143 strlen (str),
144 data,
145 size);
146 }
138 if (GNUNET_OK != res) 147 if (GNUNET_OK != res)
139 { 148 {
140 GNUNET_break_op (0); 149 GNUNET_break_op (0);
diff --git a/src/util/gnunet-base32.c b/src/util/gnunet-base32.c
index 2c797f56e..217185ed0 100644
--- a/src/util/gnunet-base32.c
+++ b/src/util/gnunet-base32.c
@@ -42,7 +42,8 @@ main (int argc,
42 const struct GNUNET_GETOPT_CommandLineOption options[] = { 42 const struct GNUNET_GETOPT_CommandLineOption options[] = {
43 GNUNET_GETOPT_option_flag ('d', 43 GNUNET_GETOPT_option_flag ('d',
44 "decode", 44 "decode",
45 gettext_noop ("run decoder modus, otherwise runs as encoder"), 45 gettext_noop (
46 "run decoder modus, otherwise runs as encoder"),
46 &decode), 47 &decode),
47 GNUNET_GETOPT_option_help ("Crockford base32 encoder/decoder"), 48 GNUNET_GETOPT_option_help ("Crockford base32 encoder/decoder"),
48 GNUNET_GETOPT_option_version (PACKAGE_VERSION), 49 GNUNET_GETOPT_option_version (PACKAGE_VERSION),
@@ -105,11 +106,12 @@ main (int argc,
105 out_size and out_size-1 below */ 106 out_size and out_size-1 below */
106 out_size = in_size * 5 / 8; 107 out_size = in_size * 5 / 8;
107 out = GNUNET_malloc (out_size); 108 out = GNUNET_malloc (out_size);
108 if (GNUNET_OK != 109 if ( (GNUNET_OK !=
109 GNUNET_STRINGS_string_to_data (in, 110 GNUNET_STRINGS_string_to_data (in,
110 in_size, 111 in_size,
111 out, 112 out,
112 out_size)) 113 out_size)) &&
114 (out_size > 0) )
113 { 115 {
114 out_size--; 116 out_size--;
115 if (GNUNET_OK != 117 if (GNUNET_OK !=