summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/iso7816.c2
-rw-r--r--src/u2f.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/iso7816.c b/src/iso7816.c
index e2ea281..a3fd280 100644
--- a/src/iso7816.c
+++ b/src/iso7816.c
@@ -13,7 +13,7 @@ iso7816_new(uint8_t ins, uint8_t p1, uint16_t payload_len)
13 iso7816_apdu_t *apdu; 13 iso7816_apdu_t *apdu;
14 size_t alloc_len; 14 size_t alloc_len;
15 15
16 alloc_len = sizeof(iso7816_apdu_t) + payload_len; 16 alloc_len = sizeof(iso7816_apdu_t) + payload_len + 2; /* le1 le2 */
17 17
18 if ((apdu = calloc(1, alloc_len)) == NULL) 18 if ((apdu = calloc(1, alloc_len)) == NULL)
19 return (NULL); 19 return (NULL);
diff --git a/src/u2f.c b/src/u2f.c
index 3f2d9aa..82b289f 100644
--- a/src/u2f.c
+++ b/src/u2f.c
@@ -439,7 +439,7 @@ encode_cred_authdata(const char *rp_id, const uint8_t *kh, uint8_t kh_len,
439 authdata.sigcount = 0; 439 authdata.sigcount = 0;
440 440
441 memset(&attcred_raw.aaguid, 0, sizeof(attcred_raw.aaguid)); 441 memset(&attcred_raw.aaguid, 0, sizeof(attcred_raw.aaguid));
442 attcred_raw.id_len = (uint16_t)(kh_len << 8); /* XXX */ 442 attcred_raw.id_len = htobe16(kh_len);
443 443
444 len = authdata_blob.len = sizeof(authdata) + sizeof(attcred_raw) + 444 len = authdata_blob.len = sizeof(authdata) + sizeof(attcred_raw) +
445 kh_len + pk_blob.len; 445 kh_len + pk_blob.len;