commit c8a6836ac2c03aeed44159a666c1c12c01c8f57c
parent e1d029f5aff931c5e56f211b69c7c1af4356bd2c
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Fri, 14 Aug 2026 18:30:52 +0200
enforce lower-bound on purpose-size as well
Diffstat:
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/util/crypto_helper_cs.c b/src/util/crypto_helper_cs.c
@@ -184,14 +184,14 @@ handle_mt_avail (struct TALER_CRYPTO_CsDenominationHelper *dh,
= (const struct TALER_CRYPTO_CsKeyAvailableNotification *) hdr;
const char *buf = (const char *) &kan[1];
const char *section_name;
- uint16_t snl;
+ uint32_t snl;
if (sizeof (*kan) > ntohs (hdr->size))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- snl = ntohs (kan->section_name_len);
+ snl = ntohl (kan->section_name_len);
if (ntohs (hdr->size) != sizeof (*kan) + snl)
{
GNUNET_break_op (0);
diff --git a/src/util/crypto_helper_esign.c b/src/util/crypto_helper_esign.c
@@ -370,6 +370,8 @@ TALER_CRYPTO_helper_esign_sign_ (
"Failed to connect to helper\n");
return TALER_EC_EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE;
}
+ GNUNET_assert (purpose_size >=
+ sizeof (struct TALER_CRYPTO_EddsaSignRequest));
GNUNET_assert (purpose_size <
UINT16_MAX - sizeof (struct TALER_CRYPTO_EddsaSignRequest));
{
diff --git a/src/util/secmod_cs.c b/src/util/secmod_cs.c
@@ -408,7 +408,7 @@ generate_response (struct DenominationKey *dk)
an = GNUNET_malloc (tlen);
an->header.size = htons ((uint16_t) tlen);
an->header.type = htons (TALER_HELPER_CS_MT_AVAIL);
- an->section_name_len = htons ((uint16_t) nlen);
+ an->section_name_len = htonl ((uint32_t) nlen);
an->anchor_time = GNUNET_TIME_timestamp_hton (dk->anchor_start);
effective_duration = GNUNET_TIME_absolute_get_difference (
dk->anchor_start.abs_time,