From 735020666ba28bffbdee18048d87d0ea9297bc57 Mon Sep 17 00:00:00 2001 From: weidai Date: Thu, 5 Feb 2004 03:35:13 +0000 Subject: [PATCH] fix ONE_AND_ZEROS_PADDING --- filters.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/filters.cpp b/filters.cpp index 7928abf4..ee372bbe 100644 --- a/filters.cpp +++ b/filters.cpp @@ -617,7 +617,7 @@ void StreamTransformationFilter::LastPut(const byte *inString, unsigned int leng } else { - space[length] = 1; + space[length] = 0x80; memset(space+length+1, 0, s-length-1); } m_cipher.ProcessData(space, space, s); @@ -637,9 +637,9 @@ void StreamTransformationFilter::LastPut(const byte *inString, unsigned int leng } else { - while (length > 1 && space[length-1] == '\0') + while (length > 1 && space[length-1] == 0) --length; - if (space[--length] != '\1') + if (space[--length] != 0x80) throw InvalidCiphertext("StreamTransformationFilter: invalid ones-and-zeros padding found"); } AttachedTransformation()->Put(space, length);