summaryrefslogtreecommitdiff
path: root/src/util/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/strings.c')
-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;