aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-11-05 21:09:36 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-11-05 21:09:36 +0900
commitd68327a9085cbc9b871fa92d23a09d1cb2b6f6b0 (patch)
tree826bf13bad032d2d4c678efba29466d234067102 /src/reclaim
parentb2b86cddc5be39a17e14f36fd5b4b70146725cc5 (diff)
downloadgnunet-d68327a9085cbc9b871fa92d23a09d1cb2b6f6b0.tar.gz
gnunet-d68327a9085cbc9b871fa92d23a09d1cb2b6f6b0.zip
-fix IPC format again; parse JWT slightly more safely
Diffstat (limited to 'src/reclaim')
-rw-r--r--src/reclaim/plugin_reclaim_credential_jwt.c12
-rw-r--r--src/reclaim/reclaim.h16
2 files changed, 15 insertions, 13 deletions
diff --git a/src/reclaim/plugin_reclaim_credential_jwt.c b/src/reclaim/plugin_reclaim_credential_jwt.c
index 5d5e221f9..3c33d4076 100644
--- a/src/reclaim/plugin_reclaim_credential_jwt.c
+++ b/src/reclaim/plugin_reclaim_credential_jwt.c
@@ -167,7 +167,19 @@ jwt_parse_attributes (void *cls,
167 167
168 jwt_string = GNUNET_strndup (data, data_size); 168 jwt_string = GNUNET_strndup (data, data_size);
169 const char *jwt_body = strtok (jwt_string, delim); 169 const char *jwt_body = strtok (jwt_string, delim);
170 if (NULL == jwt_body)
171 {
172 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
173 "Failed to parse JSON %s\n", jwt_string);
174 return attrs;
175 }
170 jwt_body = strtok (NULL, delim); 176 jwt_body = strtok (NULL, delim);
177 if (NULL == jwt_body)
178 {
179 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
180 "Failed to parse JSON %s\n", jwt_string);
181 return attrs;
182 }
171 GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body), 183 GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
172 (void **) &decoded_jwt); 184 (void **) &decoded_jwt);
173 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Decoded JWT: %s\n", decoded_jwt); 185 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Decoded JWT: %s\n", decoded_jwt);
diff --git a/src/reclaim/reclaim.h b/src/reclaim/reclaim.h
index d2d2d4b89..f457f47a8 100644
--- a/src/reclaim/reclaim.h
+++ b/src/reclaim/reclaim.h
@@ -175,12 +175,7 @@ struct CredentialResultMessage
175 /** 175 /**
176 * Length of serialized attribute data 176 * Length of serialized attribute data
177 */ 177 */
178 uint16_t credential_len GNUNET_PACKED; 178 uint32_t credential_len GNUNET_PACKED;
179
180 /**
181 * always zero (for alignment)
182 */
183 uint16_t reserved GNUNET_PACKED;
184 179
185 /** 180 /**
186 * The length of the public key 181 * The length of the public key
@@ -550,17 +545,12 @@ struct ConsumeTicketResultMessage
550 /** 545 /**
551 * Length of serialized attribute data 546 * Length of serialized attribute data
552 */ 547 */
553 uint16_t attrs_len GNUNET_PACKED; 548 uint32_t attrs_len GNUNET_PACKED;
554 549
555 /** 550 /**
556 * Length of presentation data 551 * Length of presentation data
557 */ 552 */
558 uint16_t presentations_len; 553 uint32_t presentations_len;
559
560 /**
561 * always zero (for alignment)
562 */
563 uint16_t reserved GNUNET_PACKED;
564 554
565 /** 555 /**
566 * The length of the private key 556 * The length of the private key