Diff

Differences From Artifact [595ac3f06f]:

To Artifact [1e8e0d368b]:


  1487   1487    *
  1488   1488    */
  1489   1489   static struct cackey_tlv_entity *cackey_read_tlv(struct cackey_slot *slot) {
  1490   1490   	struct cackey_tlv_entity *curr_entity, *root = NULL, *last = NULL;
  1491   1491   	unsigned char tlen_buf[2], tval_buf[1024], *tval;
  1492   1492   	unsigned char vlen_buf[2], vval_buf[8192], *vval;
  1493   1493   	unsigned char *tmpbuf;
         1494  +	unsigned long tmpbuflen;
  1494   1495   	ssize_t tlen, vlen;
  1495   1496   	ssize_t read_ret;
  1496   1497   	size_t offset_t = 0, offset_v = 0;
  1497   1498   	unsigned char tag;
  1498   1499   	size_t length;
  1499   1500   #ifdef HAVE_LIBZ
  1500         -	uLongf tmpbuflen;
  1501   1501   	int uncompress_ret;
  1502   1502   #endif
  1503   1503   
  1504   1504   	CACKEY_DEBUG_PRINTF("Called.");
  1505   1505   
  1506   1506   	read_ret = cackey_read_buffer(slot, tlen_buf, sizeof(tlen_buf), 1, offset_t);
  1507   1507   	if (read_ret != sizeof(tlen_buf)) {
................................................................................
  1598   1598   				curr_entity->value = tmpbuf;
  1599   1599   				curr_entity->_next = NULL;
  1600   1600   
  1601   1601   				break;
  1602   1602   			case GSCIS_TAG_CERTIFICATE:
  1603   1603   				curr_entity = malloc(sizeof(*curr_entity));
  1604   1604   
         1605  +#ifdef HAVE_LIBZ
  1605   1606   				tmpbuflen = length * 2;
  1606   1607   				tmpbuf = malloc(tmpbuflen);
  1607   1608   
  1608         -#ifdef HAVE_LIBZ
  1609   1609   				uncompress_ret = uncompress(tmpbuf, &tmpbuflen, vval, length);
  1610   1610   				if (uncompress_ret != Z_OK) {
  1611   1611   					CACKEY_DEBUG_PRINTF("Failed to decompress, uncompress() returned %i -- resorting to direct copy", uncompress_ret);
  1612   1612   
  1613   1613   					tmpbuflen = length;
  1614   1614   					memcpy(tmpbuf, vval, length);
  1615   1615   				}