Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a couple of missing bounds checks found via code analyzer. #8305

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ long wolfSSL_TXT_DB_write(WOLFSSL_BIO *out, WOLFSSL_TXT_DB *db)
return WOLFSSL_FAILURE;
}
}
idx[-1] = '\n';
if (idx > buf)
idx[-1] = '\n';
else
return WOLFSSL_FAILURE;
sz = (int)(idx - buf);

if (wolfSSL_BIO_write(out, buf, sz) != sz) {
Expand Down
4 changes: 3 additions & 1 deletion wolfcrypt/src/coding.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,10 @@ static int CEscape(int escaped, byte e, byte* out, word32* i, word32 maxSz,

if (raw)
basic = e;
else
else if (e <= sizeof(base64Encode))
basic = base64Encode[e];
else
return BAD_FUNC_ARG;

/* check whether to escape. Only escape for EncodeEsc */
if (escaped == WC_ESC_NL_ENC) {
Expand Down
Loading