summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexia Pagkopoulou <a.pagkopoulou@tum.de>2019-06-13 14:53:34 +0200
committerAlexia Pagkopoulou <a.pagkopoulou@tum.de>2019-06-13 14:53:34 +0200
commit5541e2e3f2b321164f3c33dfc551a8f237380393 (patch)
tree7ccb43a6795cb23e862b1053815c3fd337d449fc
parent0263818b1ec7ef1115196002f9ba70e5cb766bf4 (diff)
added check for empty nonce string
-rw-r--r--src/reclaim/oidc_helper.c6
1 files changed, 5 insertions, 1 deletions
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)
{