commit 47993fae5431c150e03fdce586f8806b86e69b53
parent 75a0133773eff771146b6dcdb9bb0239043dbcb0
Author: Florian Dold <florian.dold@gmail.com>
Date: Wed, 17 Feb 2016 03:18:07 +0100
better error handling for hash-contract
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_util.c b/src/backend/taler-merchant-httpd_util.c
@@ -85,6 +85,17 @@ MH_handler_hash_contract (struct TMH_RequestHandler *rh,
"missing 'contract' field");
}
+ if (GNUNET_OK != TALER_hash_json (jcontract,
+ &hc))
+ {
+ res = TMH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_BAD_REQUEST,
+ "{s:s, s:s}",
+ "error", "invalid contract",
+ "hint", "expected object");
+ return res;
+ }
+
GNUNET_assert (GNUNET_OK ==
TALER_hash_json (jcontract,
&hc));