Skip to content

Commit

Permalink
openpgp: Set the ecpoint_len based on received length
Browse files Browse the repository at this point in the history
This avoids buffer overrun later when the further processing assumes
the length is a field length

Signed-off-by: Jakub Jelen <[email protected]>
  • Loading branch information
Jakuje committed Aug 16, 2024
1 parent 85b8199 commit b165045
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/libopensc/card-openpgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,7 @@ pgp_parse_and_set_pubkey_output(sc_card_t *card, u8* data, size_t data_len,
LOG_FUNC_RETURN(card->ctx, SC_ERROR_NOT_ENOUGH_MEMORY);
}
memcpy(key_info->u.ec.ecpoint, part + 1, len - 1);
key_info->u.ec.ecpoint_len = len - 1;
}

/* go to next part to parse */
Expand Down

0 comments on commit b165045

Please sign in to comment.