OSDN Git Service

Merge "libc fortify: make socket.h and stdlib.h use diagnose_if"
authorTreehugger Robot <treehugger-gerrit@google.com>
Wed, 2 Aug 2017 07:37:46 +0000 (07:37 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Wed, 2 Aug 2017 07:37:46 +0000 (07:37 +0000)
1  2 
tests/fortify_compilation_test.cpp

@@@ -188,10 -188,19 +188,19 @@@ void test_recvfrom() 
    recvfrom(0, buf, 6, 0, reinterpret_cast<sockaddr*>(&addr), NULL);
  }
  
+ void test_recv() {
+   char buf[4] = {0};
+   // NOLINTNEXTLINE(whitespace/line_length)
+   // GCC: error: call to '__recvfrom_error' declared with attribute error: 'recvfrom' called with size bigger than buffer
+   // CLANG: error: 'recv' called with size bigger than buffer
+   recv(0, buf, 6, 0);
+ }
  void test_umask() {
    // NOLINTNEXTLINE(whitespace/line_length)
 -  // GCC: error: call to '__umask_invalid_mode' declared with attribute error: umask called with invalid mode
 -  // CLANG: error: call to unavailable function 'umask': umask called with invalid mode
 +  // GCC: error: call to '__umask_invalid_mode' declared with attribute error: 'umask' called with invalid mode
 +  // CLANG: error: 'umask' called with invalid mode
    umask(01777);
  }