Skip to content

Commit

Permalink
Added base64 decode input size check.
Browse files Browse the repository at this point in the history
  • Loading branch information
di-shi committed Jan 10, 2025
1 parent 92a1f7a commit 19d88a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ospb64.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ int OSPPBase64Decode(
size_t b64;

Fretval = OSPC_ERR_B64_DECODE_FAILED;
if (inSize == 0) {
return Fretval;
}

for (x = inSize - 1; in[x] == '='; x--);
b64 = (x + 1) - ((x + 1) / 4);
if ((in != OSPC_OSNULL) && (out != OSPC_OSNULL) && (inSize > 0) && (outSize != OSPC_OSNULL) && (*outSize >= b64)) {
Expand Down

1 comment on commit 19d88a4

@di-shi
Copy link
Contributor Author

@di-shi di-shi commented on 19d88a4 Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.