[vlc-commits] demux: adaptive: fix PKCS7 padding
Francois Cartegnie
git at videolan.org
Wed Jun 5 16:59:30 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jun 5 16:51:56 2019 +0200| [a968e4f071032d089da2601e9238d8100c1fac74] | committer: Francois Cartegnie
demux: adaptive: fix PKCS7 padding
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a968e4f071032d089da2601e9238d8100c1fac74
---
modules/demux/adaptive/encryption/CommonEncryption.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules/demux/adaptive/encryption/CommonEncryption.cpp b/modules/demux/adaptive/encryption/CommonEncryption.cpp
index e9b81581fe..a5a021d31a 100644
--- a/modules/demux/adaptive/encryption/CommonEncryption.cpp
+++ b/modules/demux/adaptive/encryption/CommonEncryption.cpp
@@ -124,12 +124,11 @@ size_t CommonEncryptionSession::decrypt(void *inputdata, size_t inputbytes, bool
/* last bytes */
/* remove the PKCS#7 padding from the buffer */
const uint8_t pad = reinterpret_cast<uint8_t *>(inputdata)[inputbytes - 1];
- for(uint8_t i=0; i<pad && i<=16; i++)
+ for(uint8_t i=0; i<pad && i<16; i++)
{
if(reinterpret_cast<uint8_t *>(inputdata)[inputbytes - i - 1] != pad)
break;
-
- if(i==pad)
+ if(i+1==pad)
inputbytes -= pad;
}
}
More information about the vlc-commits
mailing list