avoid allocation of 0 bytes

This commit is contained in:
Frank Morgner 2019-01-29 11:12:07 +01:00
parent f4fccfd94e
commit 6e48de83c7

View File

@ -2120,6 +2120,8 @@ auth_read_binary(struct sc_card *card, unsigned int offset,
for (jj=0; jj<rv && *(resp+jj)==0; jj++)
;
if (rv - jj == 0)
return SC_ERROR_INVALID_DATA;
bn[0].data = calloc(1, rv - jj);
if (!bn[0].data) {
rv = SC_ERROR_OUT_OF_MEMORY;