diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-10-04 15:39:18 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-10-04 15:39:18 +0200 |
commit | 862cb42ec7fa31f96b71ad4d53c25f8b77a6792a (patch) | |
tree | d9e4d4fd1e230df6cadb0dbfa5cb5641bdbdcaae | |
parent | db6732f68cd97b1617959f4fa8bdf8a0966cf7f8 (diff) |
correctly parsing timestamp given as /history parameter
-rw-r--r-- | src/backend/taler-merchant-httpd_history.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/taler-merchant-httpd_history.c b/src/backend/taler-merchant-httpd_history.c index 2e0f084a..3b33c286 100644 --- a/src/backend/taler-merchant-httpd_history.c +++ b/src/backend/taler-merchant-httpd_history.c @@ -86,6 +86,7 @@ MH_handler_history (struct TMH_RequestHandler *rh, struct GNUNET_TIME_Absolute date; json_t *response; unsigned int ret; + uint64_t seconds; response = json_array (); /*FIXME who decrefs this?*/ str = MHD_lookup_connection_value (connection, @@ -96,9 +97,13 @@ MH_handler_history (struct TMH_RequestHandler *rh, return TMH_RESPONSE_reply_bad_request (connection, "date argument missing"); - if (1 != sscanf (str, "%llu", &date.abs_value_us)) + if (1 != sscanf (str, "%llu", &seconds)) return TMH_RESPONSE_reply_bad_request (connection, "date argument must be a timestamp"); + date.abs_value_us = seconds * 1000LL * 1000LL; + if (date.abs_value_us / 1000LL / 1000LL != seconds) + return TMH_RESPONSE_reply_bad_request (connection, + "Timestamp overflowed"); ret = db->find_transactions_by_date (db->cls, date, history_cb, |