[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: fix off by one: reserve space fo
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: fix off by one: reserve space for 0-termination |
Date: |
Sat, 09 Nov 2019 21:36:22 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 77b0e836 fix off by one: reserve space for 0-termination
77b0e836 is described below
commit 77b0e836d1ca5b1aec45ba6c4c901153a22ab196
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Nov 9 21:36:19 2019 +0100
fix off by one: reserve space for 0-termination
---
src/util/util.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/util/util.c b/src/util/util.c
index 10d5d53f..fa65fc23 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -265,25 +265,22 @@ TALER_url_join (const char *base_url,
unsigned int iparam = 0;
va_list args;
struct TALER_Buffer buf = { 0 };
- size_t len = 0;
+ size_t len;
GNUNET_assert (NULL != base_url);
GNUNET_assert (NULL != path);
-
- if (strlen (base_url) == 0)
+ if (0 == strlen (base_url))
{
/* base URL can't be empty */
GNUNET_break (0);
return NULL;
}
-
if ('/' != base_url[strlen (base_url) - 1])
{
/* Must be an actual base URL! */
GNUNET_break (0);
return NULL;
}
-
if ('/' == path[0])
{
/* The path must be relative. */
@@ -291,14 +288,14 @@ TALER_url_join (const char *base_url,
return NULL;
}
- // Path should be relative to existing path of base URL
+ /* Path should be relative to existing path of base URL */
GNUNET_break ('/' != path[0]);
if ('/' == path[0])
GNUNET_break (0);
/* 1st pass: compute length */
- len += strlen (base_url) + strlen (path);
+ len = strlen (base_url) + strlen (path) + 1;
va_start (args, path);
while (1)
@@ -316,7 +313,6 @@ TALER_url_join (const char *base_url,
va_end (args);
TALER_buffer_prealloc (&buf, len);
-
TALER_buffer_write_str (&buf, base_url);
TALER_buffer_write_str (&buf, path);
@@ -325,6 +321,7 @@ TALER_url_join (const char *base_url,
{
char *key;
char *value;
+
key = va_arg (args, char *);
if (NULL == key)
break;
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: fix off by one: reserve space for 0-termination,
gnunet <=