aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_helper_rsa.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-11-19 11:47:52 +0100
committerChristian Grothoff <christian@grothoff.org>2021-11-19 11:47:52 +0100
commit68a4d901347bfa159adfe67e00f149e09800ea22 (patch)
tree9f966c9c1ea7f15954552d0832a7ef1414549735 /src/util/crypto_helper_rsa.c
parentbdaaa0f6cb8f99168ed9916064a5e4145426480c (diff)
downloadexchange-68a4d901347bfa159adfe67e00f149e09800ea22.tar.xz
-misc bugfixes
Diffstat (limited to 'src/util/crypto_helper_rsa.c')
-rw-r--r--src/util/crypto_helper_rsa.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/util/crypto_helper_rsa.c b/src/util/crypto_helper_rsa.c
index a5a001a9c..088aae9f0 100644
--- a/src/util/crypto_helper_rsa.c
+++ b/src/util/crypto_helper_rsa.c
@@ -173,22 +173,28 @@ handle_mt_avail (struct TALER_CRYPTO_RsaDenominationHelper *dh,
= (const struct TALER_CRYPTO_RsaKeyAvailableNotification *) hdr;
const char *buf = (const char *) &kan[1];
const char *section_name;
+ uint16_t ps;
+ uint16_t snl;
if (sizeof (*kan) > ntohs (hdr->size))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- if (ntohs (hdr->size) !=
- sizeof (*kan)
- + ntohs (kan->pub_size)
- + ntohs (kan->section_name_len))
+ ps = ntohs (kan->pub_size);
+ snl = ntohs (kan->section_name_len);
+ if (ntohs (hdr->size) != sizeof (*kan) + ps + snl)
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- section_name = &buf[ntohs (kan->pub_size)];
- if ('\0' != section_name[ntohs (kan->section_name_len) - 1])
+ if (0 == snl)
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ section_name = &buf[ps];
+ if ('\0' != section_name[snl - 1])
{
GNUNET_break_op (0);
return GNUNET_SYSERR;