fixed Null pointer argument in call to memcpy

This commit is contained in:
Frank Morgner 2019-01-29 11:26:14 +01:00
parent b6fadb469f
commit 1a61ae849f
1 changed files with 2 additions and 1 deletions

View File

@ -190,7 +190,8 @@ static int cac_read_binary(sc_card_t *card, unsigned int idx,
/* OK we've read the data, now copy the required portion out to the callers buffer */
priv->cached = 1;
len = MIN(count, priv->cache_buf_len-idx);
memcpy(buf, &priv->cache_buf[idx], len);
if (len && priv->cache_buf)
memcpy(buf, &priv->cache_buf[idx], len);
r = len;
done:
if (val)