Skip to content
Snippets Groups Projects
Commit dc25cb3e authored by Olivier Dion's avatar Olivier Dion Committed by Adrien Béraud
Browse files

unitTest/fileTransfer: Fix buffer overflows


Wrong constructor was used, resulting in buffer overflows.  Although it's benign
because of read only of a data section, ASAN doesn't like it at all.

Also added missing newline at end of file.

Signed-off-by: default avatarOlivier Dion <olivier.dion@savoirfairelinux.com>
Change-Id: I15553855ea368ec00456db80abb065599adc0d49
parent fa5f747c
No related branches found
No related tags found
No related merge requests found
...@@ -195,7 +195,7 @@ FileTransferTest::testCachedFileTransfer() ...@@ -195,7 +195,7 @@ FileTransferTest::testCachedFileTransfer()
// Create file to send // Create file to send
std::ofstream sendFile("SEND"); std::ofstream sendFile("SEND");
CPPUNIT_ASSERT(sendFile.is_open()); CPPUNIT_ASSERT(sendFile.is_open());
sendFile << std::string("A", 64000); sendFile << std::string(64000, 'A');
sendFile.close(); sendFile.close();
// Send File // Send File
...@@ -268,11 +268,11 @@ FileTransferTest::testMultipleFileTransfer() ...@@ -268,11 +268,11 @@ FileTransferTest::testMultipleFileTransfer()
// Create file to send // Create file to send
std::ofstream sendFile("SEND"); std::ofstream sendFile("SEND");
CPPUNIT_ASSERT(sendFile.is_open()); CPPUNIT_ASSERT(sendFile.is_open());
sendFile << std::string("A", 64000); sendFile << std::string(64000, 'A');
sendFile.close(); sendFile.close();
std::ofstream sendFile2("SEND2"); std::ofstream sendFile2("SEND2");
CPPUNIT_ASSERT(sendFile2.is_open()); CPPUNIT_ASSERT(sendFile2.is_open());
sendFile2 << std::string("B", 64000); sendFile2 << std::string(64000, 'B');
sendFile2.close(); sendFile2.close();
// Send first File // Send first File
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment