[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-twister] 27/34: fix last path token detection.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-twister] 27/34: fix last path token detection. |
Date: |
Sat, 17 Mar 2018 01:58:18 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository twister.
commit 8d7076f423d3909068c2f79cadcec37a033d4e6a
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sat Mar 10 14:37:20 2018 +0100
fix last path token detection.
The object walker now checks if the last path's token
does exist in the parent object, before returning to
the caller.
---
src/twister/taler-twister-service.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/src/twister/taler-twister-service.c
b/src/twister/taler-twister-service.c
index 7d37198..d819473 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -880,6 +880,22 @@ walk_response_object (const char *path,
return GNUNET_NO;
}
+ if ( (NULL == json_object_get (element,
+ last_token) ) &&
+ /* NOTE: if token is bad but converts to either 0, or
+ * ULONG max AND the array has such a index, then this
+ * test won't detect any error. Likewise, the method for
+ * deleting/modifying the response will operate on that
+ * same random array element. */
+ (NULL == json_array_get (element, (unsigned int) strtoul
+ (token, NULL, 10))) )
+ {
+ TALER_LOG_WARNING ("(Last) path token '%s' not found",
+ last_token);
+ GNUNET_free (path_dup);
+ return GNUNET_NO;
+ }
+
*target = GNUNET_strdup (last_token);
*parent = element;
GNUNET_free (path_dup);
@@ -927,14 +943,15 @@ modify_object (struct MHD_Connection *con,
TALER_LOG_ERROR ("Unvalid new value given: %s\n", modify_value);
modify_path[0] = '\0';
GNUNET_free (target);
+ json_decref (new_value);
return;
perform_modbody:
ret_modify = -1;
if (json_is_object (parent))
- ret_modify = json_object_set_new (parent,
- target,
- new_value);
+ ret_modify = json_object_set (parent,
+ target,
+ new_value);
if (json_is_array (parent))
ret_modify = json_array_set_new
(parent,
@@ -945,6 +962,7 @@ modify_object (struct MHD_Connection *con,
modify_path[0] = '\0';
GNUNET_free (target);
+ json_decref (new_value);
return;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-twister] 03/34: get path parsing to compile., (continued)
- [GNUnet-SVN] [taler-twister] 03/34: get path parsing to compile., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 07/34: fix actual object emptying., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 13/34: conditional delete., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 30/34: body malformation test CMD., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 14/34: logging, gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 12/34: test command to empty objects., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 16/34: fix proxied response headers., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 17/34: moving object-killer into helper function., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 18/34: avoid duplicating tokenized string., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 02/34: parse proxied response., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 27/34: fix last path token detection.,
gnunet <=
- [GNUnet-SVN] [taler-twister] 28/34: new-line, gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 33/34: rely again on RNG., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 25/34: make mods cumulative, gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 20/34: option name., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 24/34: add testing-lib command to modify responses., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 31/34: implement upload data malformation., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 34/34: leading slash when constructing twister url., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 19/34: renaming operation., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 26/34: remove number conversion, for now., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-twister] 32/34: fix headers preparation for malformed uploads., gnunet, 2018/03/16