We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c6b7ffc commit 4cd601cCopy full SHA for 4cd601c
1 file changed
wolfssl-gnutls-wrapper/src/pk.c
@@ -1790,14 +1790,18 @@ static int wolfssl_pk_verify_rsa_pss(const gnutls_datum_t *vdata,
1790
static int parse_der_length(const byte* sig_data, word32 sig_len,
1791
word32* idx, word32* len)
1792
{
1793
- if (*idx >= sig_len) return -1;
+ if (*idx >= sig_len)
1794
+ return -1;
1795
1796
*len = sig_data[(*idx)++];
1797
1798
if (*len & 0x80) {
1799
/* Long form length */
1800
word32 num_bytes = *len & 0x7F;
- 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
1804
1805
*len = 0;
1806
while (num_bytes--) {
1807
*len = (*len << 8) | sig_data[(*idx)++];
0 commit comments