[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 02/02: make static analysis happier
From: |
gnunet |
Subject: |
[gnunet] 02/02: make static analysis happier |
Date: |
Tue, 03 Mar 2020 12:35:31 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit d1bdcb2618b13c3289492347550feb3fcf1f812d
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Mar 3 12:31:23 2020 +0100
make static analysis happier
---
src/util/configuration.c | 3 ++-
src/util/strings.c | 11 ++++++++---
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 0480ebd5d..7ed87cc1e 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -1241,7 +1241,7 @@ GNUNET_CONFIGURATION_have_value (const struct
GNUNET_CONFIGURATION_Handle *cfg,
* @param cfg configuration to use for path expansion
* @param orig string to $-expand (will be freed!)
* @param depth recursion depth, used to detect recursive expansions
- * @return $-expanded string
+ * @return $-expanded string, never NULL unless @a orig was NULL
*/
static char *
expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -1421,6 +1421,7 @@ GNUNET_CONFIGURATION_expand_dollar (
continue;
dup = GNUNET_strdup (orig + i);
dup = expand_dollar (cfg, dup, 0);
+ GNUNET_assert (NULL != dup); /* make compiler happy */
len = strlen (dup) + 1;
orig = GNUNET_realloc (orig, i + len);
GNUNET_memcpy (orig + i, dup, len);
diff --git a/src/util/strings.c b/src/util/strings.c
index a291dc4e1..f3089bf65 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -1932,6 +1932,7 @@ GNUNET_STRINGS_base64url_encode (const void *in, size_t
len, char **output)
return strlen (enc);
}
+
#define cvtfind(a) \
((((a) >= 'A') && ((a) <= 'Z')) \
? (a) - 'A' \
@@ -1964,7 +1965,7 @@ GNUNET_STRINGS_base64_decode (const char *data, size_t
len, void **out)
"ignoring CR/LF\n"); \
i++; \
if (i >= len) \
- goto END; \
+ goto END; \
}
output = GNUNET_malloc ((len * 3 / 4) + 8);
@@ -2046,16 +2047,20 @@ GNUNET_STRINGS_base64url_decode (const char *data,
size_t len, void **out)
case 0:
break; // No pad chars in this case
case 2:
- strncpy (&s[len], "==", 2);
+ memcpy (&s[len],
+ "==",
+ 2);
+ len += 2;
break; // Two pad chars
case 3:
s[len] = '=';
+ len++;
break; // One pad char
default:
GNUNET_assert (0);
break;
}
- ret = GNUNET_STRINGS_base64_decode (s, strlen (s), out);
+ ret = GNUNET_STRINGS_base64_decode (s, len, out);
GNUNET_free (s);
return ret;
}
--
To stop receiving notification emails like this one, please contact
address@hidden.