summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-03 18:50:09 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-03 18:50:09 +0200
commit6d7fd3328a2ffe42ef52f914d913f1ee4d290adc (patch)
tree15bc27a8e17a24c67399dd04336b945a02c24a97 /src/util
parent6fd24eef238349d71ddd5bff7b87b3404e972ba6 (diff)
fix #6157
Diffstat (limited to 'src/util')
-rw-r--r--src/util/strings.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util/strings.c b/src/util/strings.c
index be2ec33dc..9510b3b3b 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -972,14 +972,14 @@ GNUNET_STRINGS_string_to_data (const char *enc,
void *out,
size_t out_size)
{
- unsigned int rpos;
- unsigned int wpos;
+ size_t rpos;
+ size_t wpos;
unsigned int bits;
unsigned int vbit;
int ret;
int shift;
unsigned char *uout;
- unsigned int encoded_len = out_size * 8;
+ size_t encoded_len;
if (0 == enclen)
{
@@ -987,6 +987,8 @@ GNUNET_STRINGS_string_to_data (const char *enc,
return GNUNET_OK;
return GNUNET_SYSERR;
}
+ GNUNET_assert (out_size < SIZE_MAX / 8);
+ encoded_len = out_size * 8;
uout = out;
wpos = out_size;
rpos = enclen;