Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
use correct padding logic for block ciphers
Browse files Browse the repository at this point in the history
  • Loading branch information
ksivask committed May 4, 2024
1 parent 8b3ebc9 commit f273a3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/jwe.c
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,7 @@ static void r_jwe_remove_padding(unsigned char * text, size_t * text_len, unsign
unsigned char pad = text[(*text_len)-1], i;
int pad_ok = 1;

if (pad && pad < (unsigned char)block_size) {
if (pad && pad <= (unsigned char)block_size) {
for (i=0; i<pad; i++) {
if (text[((*text_len)-i-1)] != pad) {
pad_ok = 0;
Expand Down

0 comments on commit f273a3d

Please sign in to comment.