aboutsummaryrefslogtreecommitdiff
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)
downloadgnunet-5541e2e3f2b321164f3c33dfc551a8f237380393.tar.gz
gnunet-5541e2e3f2b321164f3c33dfc551a8f237380393.zip
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,
405 attrs_ser = NULL; 405 attrs_ser = NULL;
406 signature_payload_len = 406 signature_payload_len =
407 sizeof (struct GNUNET_RECLAIM_Ticket) + sizeof (uint32_t); 407 sizeof (struct GNUNET_RECLAIM_Ticket) + sizeof (uint32_t);
408
408 if (NULL != attrs) 409 if (NULL != attrs)
409 { 410 {
410 attr_list_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); 411 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,
415 attrs_ser = GNUNET_malloc (attr_list_len); 416 attrs_ser = GNUNET_malloc (attr_list_len);
416 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, attrs_ser); 417 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, attrs_ser);
417 } 418 }
419
418 code_payload_len = sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 420 code_payload_len = sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
419 sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) + 421 sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) +
420 signature_payload_len + 422 signature_payload_len +
@@ -427,9 +429,10 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
427 buf_ptr = plaintext; 429 buf_ptr = plaintext;
428 memcpy (buf_ptr, ticket, sizeof (struct GNUNET_RECLAIM_Ticket)); 430 memcpy (buf_ptr, ticket, sizeof (struct GNUNET_RECLAIM_Ticket));
429 buf_ptr += sizeof (struct GNUNET_RECLAIM_Ticket); 431 buf_ptr += sizeof (struct GNUNET_RECLAIM_Ticket);
432
430 // Then copy nonce 433 // Then copy nonce
431 nonce = 0; 434 nonce = 0;
432 if (NULL != nonce_str) 435 if (NULL != nonce_str && strcmp("", nonce_str) != 0)
433 { 436 {
434 if ((1 != SSCANF (nonce_str, "%u", &nonce)) || (nonce > UINT32_MAX)) 437 if ((1 != SSCANF (nonce_str, "%u", &nonce)) || (nonce > UINT32_MAX))
435 { 438 {
@@ -447,6 +450,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
447 nonce_tmp = htonl (nonce); 450 nonce_tmp = htonl (nonce);
448 memcpy (buf_ptr, &nonce_tmp, sizeof (uint32_t)); 451 memcpy (buf_ptr, &nonce_tmp, sizeof (uint32_t));
449 buf_ptr += sizeof (uint32_t); 452 buf_ptr += sizeof (uint32_t);
453
450 // Finally, attributes 454 // Finally, attributes
451 if (NULL != attrs_ser) 455 if (NULL != attrs_ser)
452 { 456 {