diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-06-04 10:30:16 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-06-04 10:30:16 +0000 |
commit | 3836ff2733d40e1182e301ef7de3eff9469777ae (patch) | |
tree | 50ae3276d6f22da433b59df6c8b791bee42ab6c0 /lib/sanitizer_common/sanitizer_libc.cc | |
parent | 4e6c6c75a241644c52fd6e62ff3ad7aef7f5c523 (diff) |
[Sanitizer] Move internal_strncpy to sanitizer_libc (and make its behavior conforming to manual)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_libc.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_libc.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_libc.cc b/lib/sanitizer_common/sanitizer_libc.cc index c9474fbcd..6c07864fe 100644 --- a/lib/sanitizer_common/sanitizer_libc.cc +++ b/lib/sanitizer_common/sanitizer_libc.cc @@ -10,6 +10,7 @@ // This file is shared between AddressSanitizer and ThreadSanitizer // run-time libraries. See sanitizer_libc.h for details. //===----------------------------------------------------------------------===// +#include "sanitizer_defs.h" #include "sanitizer_libc.h" namespace __sanitizer { @@ -17,4 +18,13 @@ namespace __sanitizer { void MiniLibcStub() { } +char *internal_strncpy(char *dst, const char *src, uptr n) { + uptr i; + for (i = 0; i < n && src[i]; i++) + dst[i] = src[i]; + for (; i < n; i++) + dst[i] = '\0'; + return dst; +} + } // namespace __sanitizer |