diff options
author | Jeffrey Walton <noloader@gmail.com> | 2023-04-21 10:34:59 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2023-04-21 10:34:59 -0400 |
commit | 16a8708c580904468d7fa1de812389091697636a (patch) | |
tree | 48662de6be28117a1b46d132f3da442cefe4a0b1 | |
parent | 3b8c9303b46219ab4fa080066d903360493873f8 (diff) | |
download | cryptopp-git-16a8708c580904468d7fa1de812389091697636a.tar.gz |
Handle '\r\0' from early RFCs in Readline
-rw-r--r-- | datatest.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/datatest.cpp b/datatest.cpp index f3a8766f..caadf5a4 100644 --- a/datatest.cpp +++ b/datatest.cpp @@ -48,7 +48,7 @@ typedef std::map<std::string, std::string> TestData; const TestData *s_currentTestData = NULLPTR;
const std::string testDataFilename = "cryptest.dat";
-// Handles CR, LF, and CRLF properly
+// Handles CR, LF, and CRLF properly. Early RFC's used '\r\0' on occasion.
// For istream.fail() see https://stackoverflow.com/q/34395801/608639.
bool Readline(std::istream& stream, std::string& line)
{
@@ -66,6 +66,8 @@ bool Readline(std::istream& stream, std::string& line) int next = stream.peek();
if (next == '\n')
(void)stream.get();
+ else if (next == '\0')
+ (void)stream.get();
break;
}
@@ -74,8 +76,6 @@ bool Readline(std::istream& stream, std::string& line) break;
}
- // Let string class manage its own capacity.
- // The string will grow as needed.
temp.push_back(static_cast<char>(ch));
}
|