Skip to content

Commit

Permalink
fixed compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmorgner committed Aug 27, 2019
1 parent a3fc769 commit 9b4b080
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/libopensc/asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,14 @@ static int decode_bit_string(const u8 * inbuf, size_t inlen, void *outbuf,
int zero_bits;
size_t octets_left;

if (outlen < octets_left)
return SC_ERROR_BUFFER_TOO_SMALL;
if (inlen < 1)
return SC_ERROR_INVALID_ASN1_OBJECT;

memset(outbuf, 0, outlen);
zero_bits = *in & 0x07;
octets_left = inlen - 1;
in++;
memset(outbuf, 0, outlen);
octets_left = inlen - 1;
if (outlen < octets_left)
return SC_ERROR_BUFFER_TOO_SMALL;

while (octets_left) {
/* 1st octet of input: ABCDEFGH, where A is the MSB */
Expand Down

0 comments on commit 9b4b080

Please sign in to comment.