Overview
| Comment: | Fix issue with buffer being undersized | 
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive | 
| Timelines: | family | ancestors | descendants | both | trunk | 
| Files: | files | file ages | folders | 
| SHA1: | 
0c4b46764022afe4d7b73eeba7e3110d | 
| User & Date: | roykeene on 2021-10-30 19:47:11 | 
| Other Links: | manifest | tags | 
Context
| 
   2021-10-30 
 | ||
| 20:27 | CACKey 0.7.11 check-in: e6b5859a01 user: rkeene tags: 0.7.11, trunk | |
| 19:47 | Fix issue with buffer being undersized check-in: 0c4b467640 user: roykeene tags: trunk | |
| 
   2019-11-15 
 | ||
| 15:07 | Integrated RFC 6234 SHA1 implementation changes check-in: fa9ae90eae user: rkeene tags: 0.7.10, trunk | |
Changes
Modified cackey.c from [11f5663297] to [e8309dfff8].
| ︙ | ︙ | |||
1916 1917 1918 1919 1920 1921 1922  | 
static ssize_t cackey_get_data(struct cackey_slot *slot, unsigned char *buffer, size_t buffer_len, unsigned char oid[3]) {
	unsigned char cmd[] = {0x5C, 0x03, 0x00, 0x00, 0x00};
	unsigned char *buffer_p;
	size_t init_buffer_len, size;
	uint16_t respcode;
	int send_ret;
 | |  | 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930  | 
static ssize_t cackey_get_data(struct cackey_slot *slot, unsigned char *buffer, size_t buffer_len, unsigned char oid[3]) {
	unsigned char cmd[] = {0x5C, 0x03, 0x00, 0x00, 0x00};
	unsigned char *buffer_p;
	size_t init_buffer_len, size;
	uint16_t respcode;
	int send_ret;
	CACKEY_DEBUG_PRINTF("Called with buffer_len = %llu", (unsigned long long) buffer_len);
	init_buffer_len = buffer_len;
	cmd[2] = oid[0];
	cmd[3] = oid[1];
	cmd[4] = oid[2];
 | 
| ︙ | ︙ | |||
1955 1956 1957 1958 1959 1960 1961  | 
	if (buffer_len < 2) {
		CACKEY_DEBUG_PRINTF("APDU GET DATA returned %lu bytes, which is too short for a BER-TLV response", (unsigned long) buffer_len);
		return(-1);
	}
 | |  | 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969  | 
	if (buffer_len < 2) {
		CACKEY_DEBUG_PRINTF("APDU GET DATA returned %lu bytes, which is too short for a BER-TLV response", (unsigned long) buffer_len);
		return(-1);
	}
	size = init_buffer_len;
	buffer_p = cackey_read_bertlv_tag(buffer, &buffer_len, 0x53, NULL, &size);
	if (buffer_p == NULL) {
		CACKEY_DEBUG_PRINTF("Tag decoding failed, returning in error.");
		return(-1);
	}
 | 
| ︙ | ︙ | |||
2599 2600 2601 2602 2603 2604 2605  | 
 */
static struct cackey_pcsc_identity *cackey_read_certs(struct cackey_slot *slot, struct cackey_pcsc_identity *certs, unsigned long *count) {
	cackey_pcsc_id_type check_id_type;
	struct cackey_pcsc_identity *curr_id;
	struct cackey_tlv_entity *ccc_tlv, *ccc_curr, *app_tlv, *app_curr;
	unsigned char *piv_oid, piv_oid_pivauth[] = {NISTSP800_73_3_OID_PIVAUTH}, piv_oid_signature[] = {NISTSP800_73_3_OID_SIGNATURE}, piv_oid_keymgt[] = {NISTSP800_73_3_OID_KEYMGT};
	unsigned char curr_aid[7];
 | |  | 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613  | 
 */
static struct cackey_pcsc_identity *cackey_read_certs(struct cackey_slot *slot, struct cackey_pcsc_identity *certs, unsigned long *count) {
	cackey_pcsc_id_type check_id_type;
	struct cackey_pcsc_identity *curr_id;
	struct cackey_tlv_entity *ccc_tlv, *ccc_curr, *app_tlv, *app_curr;
	unsigned char *piv_oid, piv_oid_pivauth[] = {NISTSP800_73_3_OID_PIVAUTH}, piv_oid_signature[] = {NISTSP800_73_3_OID_SIGNATURE}, piv_oid_keymgt[] = {NISTSP800_73_3_OID_KEYMGT};
	unsigned char curr_aid[7];
	unsigned char buffer[1024 * 32], *buffer_p, *tmpbuf;
	unsigned long outidx = 0;
	char *piv_label;
	cackey_ret transaction_ret;
	ssize_t read_ret;
	size_t buffer_len, tmpbuflen;
	int certs_resizable;
	int send_ret, select_ret;
 | 
| ︙ | ︙ |