cryptopp: fixup DOS newlines in CVE-2016-9939 patch

The patch did contain the correct newlines, but they got stripped by
patchwork so now the patch no longer applies.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Peter Korsgaard 2016-12-29 00:01:54 +01:00
parent e298cf06f6
commit 9f57959147

View File

@ -14,56 +14,56 @@ index 297ff01..2e923ef 100644
--- a/asn.cpp --- a/asn.cpp
+++ b/asn.cpp +++ b/asn.cpp
@@ -123,6 +123,8 @@ size_t BERDecodeOctetString(BufferedTransformation &bt, SecByteBlock &str) @@ -123,6 +123,8 @@ size_t BERDecodeOctetString(BufferedTransformation &bt, SecByteBlock &str)
size_t bc; size_t bc;
if (!BERLengthDecode(bt, bc)) if (!BERLengthDecode(bt, bc))
BERDecodeError(); BERDecodeError();
+ if (bc > bt.MaxRetrievable()) + if (bc > bt.MaxRetrievable())
+ BERDecodeError(); + BERDecodeError();
str.New(bc); str.New(bc);
if (bc != bt.Get(str, bc)) if (bc != bt.Get(str, bc))
@@ -139,6 +141,8 @@ size_t BERDecodeOctetString(BufferedTransformation &bt, BufferedTransformation & @@ -139,6 +141,8 @@ size_t BERDecodeOctetString(BufferedTransformation &bt, BufferedTransformation &
size_t bc; size_t bc;
if (!BERLengthDecode(bt, bc)) if (!BERLengthDecode(bt, bc))
BERDecodeError(); BERDecodeError();
+ if (bc > bt.MaxRetrievable()) + if (bc > bt.MaxRetrievable())
+ BERDecodeError(); + BERDecodeError();
bt.TransferTo(str, bc); bt.TransferTo(str, bc);
return bc; return bc;
@@ -161,6 +165,8 @@ size_t BERDecodeTextString(BufferedTransformation &bt, std::string &str, byte as @@ -161,6 +165,8 @@ size_t BERDecodeTextString(BufferedTransformation &bt, std::string &str, byte as
size_t bc; size_t bc;
if (!BERLengthDecode(bt, bc)) if (!BERLengthDecode(bt, bc))
BERDecodeError(); BERDecodeError();
+ if (bc > bt.MaxRetrievable()) + if (bc > bt.MaxRetrievable())
+ BERDecodeError(); + BERDecodeError();
SecByteBlock temp(bc); SecByteBlock temp(bc);
if (bc != bt.Get(temp, bc)) if (bc != bt.Get(temp, bc))
@@ -188,6 +194,10 @@ size_t BERDecodeBitString(BufferedTransformation &bt, SecByteBlock &str, unsigne @@ -188,6 +194,10 @@ size_t BERDecodeBitString(BufferedTransformation &bt, SecByteBlock &str, unsigne
size_t bc; size_t bc;
if (!BERLengthDecode(bt, bc)) if (!BERLengthDecode(bt, bc))
BERDecodeError(); BERDecodeError();
+ if (bc == 0) + if (bc == 0)
+ BERDecodeError(); + BERDecodeError();
+ if (bc > bt.MaxRetrievable()) + if (bc > bt.MaxRetrievable())
+ BERDecodeError(); + BERDecodeError();
byte unused; byte unused;
if (!bt.Get(unused)) if (!bt.Get(unused))
diff --git a/asn.h b/asn.h diff --git a/asn.h b/asn.h
index ed9de52..33f0dd0 100644 index ed9de52..33f0dd0 100644
--- a/asn.h --- a/asn.h
+++ b/asn.h +++ b/asn.h
@@ -498,6 +498,8 @@ void BERDecodeUnsigned(BufferedTransformation &in, T &w, byte asnTag = INTEGER, @@ -498,6 +498,8 @@ void BERDecodeUnsigned(BufferedTransformation &in, T &w, byte asnTag = INTEGER,
bool definite = BERLengthDecode(in, bc); bool definite = BERLengthDecode(in, bc);
if (!definite) if (!definite)
BERDecodeError(); BERDecodeError();
+ if (bc > in.MaxRetrievable()) + if (bc > in.MaxRetrievable())
+ BERDecodeError(); + BERDecodeError();
SecByteBlock buf(bc); SecByteBlock buf(bc);
-- --
2.10.2 2.10.2