commit 5dce1d11940ecccb834099f7255a4fb7b06e8144
parent c53259cff2690626660f5953319679be548f80c7
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Wed, 8 Oct 2025 11:24:57 +0200
check rval, fix uninitialized output_index
Diffstat:
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_post-challenge-ID.c b/src/backend/taler-merchant-httpd_post-challenge-ID.c
@@ -444,7 +444,8 @@ phase_send_challenge (struct MfaState *mfa)
NULL);
if (NULL == mfa->child)
{
- GNUNET_DISK_pipe_close (p);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_DISK_pipe_close (p));
respond_with_error (mfa,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_MERCHANT_TAN_MFA_HELPER_EXEC_FAILED,
@@ -455,7 +456,8 @@ phase_send_challenge (struct MfaState *mfa)
pipe_stdin = GNUNET_DISK_pipe_detach_end (p,
GNUNET_DISK_PIPE_END_WRITE);
GNUNET_assert (NULL != pipe_stdin);
- GNUNET_DISK_pipe_close (p);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_DISK_pipe_close (p));
GNUNET_asprintf (&mfa->msg,
"%s\nTaler-Merchant:\n%s",
mfa->code,
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -459,6 +459,11 @@ struct PayContext
unsigned int output_tokens_len;
/**
+ * Counter used to generate the output index in append_output_token_sig().
+ */
+ unsigned int output_index_gen;
+
+ /**
* HTTP status code to use for the reply, i.e 200 for "OK".
* Special value UINT_MAX is used to indicate hard errors
* (no reply, return #MHD_NO).
@@ -3846,6 +3851,7 @@ append_output_token_sig (void *cls,
struct PayContext *pc = cls;
struct SignedOutputToken out;
+ out.output_index = pc->output_index_gen++;
out.h_issue.hash = *h_issue;
out.sig.signature = sig;
GNUNET_array_append (pc->output_tokens,
@@ -3932,6 +3938,7 @@ phase_contract_paid (struct PayContext *pc)
/* Everything fine, idempotent request, generate response immediately */
enum GNUNET_DB_QueryStatus qs;
+ pc->output_index_gen = 0;
qs = TMH_db->select_order_blinded_sigs (
TMH_db->cls,
pc->order_id,