Skip to content

Commit 4cd601c

Browse files
committed
- return statesments on new lines;
- return -1 on num_bytes = 0 (unsupported);
1 parent c6b7ffc commit 4cd601c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • wolfssl-gnutls-wrapper/src

wolfssl-gnutls-wrapper/src/pk.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,14 +1790,18 @@ static int wolfssl_pk_verify_rsa_pss(const gnutls_datum_t *vdata,
17901790
static int parse_der_length(const byte* sig_data, word32 sig_len,
17911791
word32* idx, word32* len)
17921792
{
1793-
if (*idx >= sig_len) return -1;
1793+
if (*idx >= sig_len)
1794+
return -1;
17941795

17951796
*len = sig_data[(*idx)++];
17961797

17971798
if (*len & 0x80) {
17981799
/* Long form length */
17991800
word32 num_bytes = *len & 0x7F;
1800-
if (num_bytes > 4 || *idx + num_bytes > sig_len) return -1;
1801+
1802+
if (num_bytes == 0 || num_bytes > 4 || *idx + num_bytes > sig_len)
1803+
return -1;
1804+
18011805
*len = 0;
18021806
while (num_bytes--) {
18031807
*len = (*len << 8) | sig_data[(*idx)++];

0 commit comments

Comments
 (0)