Skip to content

Commit 9c467a9

Browse files
authored
Merge pull request #9437 from rlm2002/coverity
20251114 Coverity change
2 parents 86789f9 + 59800d8 commit 9c467a9

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

wolfcrypt/src/evp.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13062,20 +13062,26 @@ int wolfSSL_EVP_DecodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx,
1306213062
return 1;
1306313063

1306413064
}
13065-
/* if the last data is '\n', remove it */
13066-
c = in[j - 1];
13067-
if (c == '\n') {
13068-
c = (in[j - 2]);
13065+
/* If the last data is '\n', remove it */
13066+
if (j > 0) {
13067+
c = in[j - 1];
13068+
if (c == '\n' && (j > 1)) {
13069+
c = (in[j - 2]);
13070+
if (c == '=')
13071+
return 0;
13072+
else
13073+
return 1;
13074+
} else if (c == '\n') {
13075+
return 1;
13076+
}
1306913077
if (c == '=')
1307013078
return 0;
1307113079
else
1307213080
return 1;
1307313081
}
13074-
if (c == '=')
13075-
return 0;
13076-
else
13077-
return 1;
1307813082

13083+
/* j == 0 */
13084+
return 1;
1307913085
}
1308013086
/* wolfSSL_EVP_DecodeFinal decode remaining data in ctx
1308113087
* to outputs to out.

0 commit comments

Comments
 (0)