Add stpcpy/stpncpy.
Add tests for the above. Add the fortify implementations of __stpcpy_chk and __stpncpy_chk. Modify the strncpy test to cover more cases and use this template for stpncpy. Add all of the fortify test cases. Bug: 13746695 Change-Id: I8c0f0d4991a878b8e8734fff12c8b73b07fdd344
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#undef _FORTIFY_SOURCE
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "private/libc_logging.h"
|
||||
@@ -41,7 +43,7 @@
|
||||
* This strcpy check is called if _FORTIFY_SOURCE is defined and
|
||||
* greater than 0.
|
||||
*/
|
||||
extern "C" char* __strcpy_chk (char* dest, const char* src, size_t dest_len) {
|
||||
extern "C" char* __strcpy_chk(char* dest, const char* src, size_t dest_len) {
|
||||
// TODO: optimize so we don't scan src twice.
|
||||
size_t src_len = strlen(src) + 1;
|
||||
if (__predict_false(src_len > dest_len)) {
|
||||
|
Reference in New Issue
Block a user