From 5541e2e3f2b321164f3c33dfc551a8f237380393 Mon Sep 17 00:00:00 2001 From: Alexia Pagkopoulou Date: Thu, 13 Jun 2019 14:53:34 +0200 Subject: added check for empty nonce string --- src/reclaim/oidc_helper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c index e4949a037..d2789f978 100644 --- a/src/reclaim/oidc_helper.c +++ b/src/reclaim/oidc_helper.c @@ -405,6 +405,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, attrs_ser = NULL; signature_payload_len = sizeof (struct GNUNET_RECLAIM_Ticket) + sizeof (uint32_t); + if (NULL != attrs) { attr_list_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); @@ -415,6 +416,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, attrs_ser = GNUNET_malloc (attr_list_len); GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, attrs_ser); } + code_payload_len = sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) + signature_payload_len + @@ -427,9 +429,10 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, buf_ptr = plaintext; memcpy (buf_ptr, ticket, sizeof (struct GNUNET_RECLAIM_Ticket)); buf_ptr += sizeof (struct GNUNET_RECLAIM_Ticket); + // Then copy nonce nonce = 0; - if (NULL != nonce_str) + if (NULL != nonce_str && strcmp("", nonce_str) != 0) { if ((1 != SSCANF (nonce_str, "%u", &nonce)) || (nonce > UINT32_MAX)) { @@ -447,6 +450,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, nonce_tmp = htonl (nonce); memcpy (buf_ptr, &nonce_tmp, sizeof (uint32_t)); buf_ptr += sizeof (uint32_t); + // Finally, attributes if (NULL != attrs_ser) { -- cgit v1.2.3