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

base64: fix cppcheck warnings #819

Merged
merged 1 commit into from
May 21, 2023
Merged
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
12 changes: 6 additions & 6 deletions src/base64/b64.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ int base64_encode(const uint8_t *in, size_t ilen, char *out, size_t *olen)
*/
int base64url_encode(const uint8_t *in, size_t ilen, char *out, size_t *olen)
{
const uint8_t *in_end = in + ilen;
const char *o = out;

if (!in || !out || !olen)
return EINVAL;

const uint8_t *in_end = in + ilen;
const char *o = out;

if (*olen < 4 * ((ilen+2)/3))
return EOVERFLOW;

Expand Down Expand Up @@ -185,12 +185,12 @@ static inline uint32_t b64val(char c)
*/
int base64_decode(const char *in, size_t ilen, uint8_t *out, size_t *olen)
{
const char *in_end = in + ilen;
const uint8_t *o = out;

if (!in || !out || !olen)
return EINVAL;

const char *in_end = in + ilen;
const uint8_t *o = out;

if (*olen < 3 * (ilen/4))
return EOVERFLOW;

Expand Down