test : ensure \0 at the end of buffers read from files
authorEdouard Tisserant
Fri, 17 Apr 2015 01:17:59 +0200
changeset 206550328f5c103
parent 188 0a882568ccd3
child 207 b17a74f2acd9
test : ensure \0 at the end of buffers read from files
test/pEpEngineTest.cc
     1.1 --- a/test/pEpEngineTest.cc	Mon Apr 13 19:00:53 2015 +0200
     1.2 +++ b/test/pEpEngineTest.cc	Fri Apr 17 01:17:59 2015 +0200
     1.3 @@ -22,10 +22,11 @@
     1.4          length = txtFile.tellg();
     1.5          txtFile.seekg (0, txtFile.beg);
     1.6  
     1.7 -        buffer = new char [length];
     1.8 +        buffer = new char [length+1];
     1.9  
    1.10          cout << "Reading " << length << " characters... ";
    1.11          txtFile.read (buffer,length);
    1.12 +        buffer[length]='\0';
    1.13  
    1.14          if (txtFile)
    1.15            cout << "all characters read successfully.\n";
    1.16 @@ -110,7 +111,7 @@
    1.17      size_t t2_length = 0;
    1.18      ReadFileIntoMem("t2.txt", t2_buffer, t2_length);
    1.19  
    1.20 -    cout << "\ncalling verify_test()\n";
    1.21 +    cout << "\ncalling verify_text()\n";
    1.22      verify_result = verify_text(session, t2_buffer, t2_length, sig_buffer, sig_length, &keylist);
    1.23      assert(verify_result == PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH);
    1.24      free_stringlist(keylist);