android_system_core/libcutils
Christopher Ferris 626efb78a6 Fix incorrect handling of snprintf return value.
The code assumed that snprintf would never return a value less than
the passed in size of the buffer. This is not accurate, so fix all
of the places this assumptions is made. Also, if the name is too large,
then truncate just the name to make everything fit.

Added a new set of tests for this code. Verified that the old code passes
on the _normal and _exact version of the tests, but fails with the
FORTIFY error on the _truncated version of the tests. All tests pass
on the new code.

Bug: 27324359
Change-Id: I1b64ddde6f5ff2ec7f6428b998d21d41a1236b14
2016-02-25 12:46:44 -08:00
..
arch-arm Switch arch-arm/memset32.S to unified syntax. 2015-05-11 22:22:13 -07:00
arch-arm64 Add android_memset16/android_memset32 for aarch64. 2014-06-23 19:28:33 -07:00
arch-mips android_memset.c: Use sanitized shifts 2015-08-27 14:32:17 -07:00
arch-x86 Clean up memset[16,32] routines: unify files names, remove redundant wrapper 2014-09-17 18:11:18 +04:00
arch-x86_64 Clean up memset[16,32] routines: unify files names, remove redundant wrapper 2014-09-17 18:11:18 +04:00
tests Fix incorrect handling of snprintf return value. 2016-02-25 12:46:44 -08:00
Android.mk libcutils/fastboot: improve multi-buffer write. 2016-02-03 10:01:38 -08:00
android_reboot.c Use fsck.f2fs -a instead of -f for faster boot 2015-07-15 10:13:51 -07:00
ashmem-dev.c libcutils: abort for invalid fd 2016-02-03 15:09:20 -08:00
ashmem-host.c libcutils: ashmem fortify and comply with Android coding standard 2016-02-02 12:38:06 -08:00
atomic.c Second attempt to "Rewrite atomic.h to use stdatomic.h." 2014-11-13 15:59:10 -08:00
config_utils.c Config utils improvement 2011-05-26 13:57:03 -07:00
debugger.c Don't use TEMP_FAILURE_RETRY on close in system/core. 2015-05-27 13:27:06 -07:00
dlmalloc_stubs.c Fix libcutils/dlmalloc_stubs.c build breakage. 2014-06-03 20:48:44 -07:00
fs.c fs_mkdirs: use O_NOFOLLOW and O_CLOEXEC 2014-06-16 15:40:40 -07:00
fs_config.c fs_config.c: Remove obsolete reference to /system/bin/pppd-ril 2015-11-30 09:17:18 -08:00
hashmap.c libcutils: cleanups for -fsanitize=integer 2015-08-26 10:40:00 -07:00
iosched_policy.c Use __ANDROID__ instead of HAVE_ANDROID_OS. 2015-07-30 09:33:43 -07:00
klog.c logging: avoid unnecessary printfs 2016-01-16 16:20:24 -08:00
load_file.c auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
MODULE_LICENSE_APACHE2 auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
multiuser.c File-system utilities for installd and zygote. 2012-08-30 10:29:41 -07:00
native_handle.c Prevent integer overflow when allocating native_handle_t 2015-05-15 13:09:39 -07:00
NOTICE auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
open_memstream.c Remove dead code. 2014-11-08 11:32:07 -08:00
partition_utils.c libcutils: turn on -Werror 2014-05-01 17:58:17 -07:00
process_name.c Use __ANDROID__ instead of HAVE_ANDROID_OS. 2015-07-30 09:33:43 -07:00
properties.c Remove loghack.h. 2015-02-21 09:46:31 +00:00
qtaguid.c Clean up CLOEXEC in qtaguid. 2016-02-19 18:13:51 -08:00
record_stream.c Use _WIN32 rather than HAVE_WINSOCK. 2015-07-29 17:45:24 -07:00
sched_policy.c am fb1ecbc5: am e6e71608: Merge "Use __ANDROID__ instead of HAVE_ANDROID_OS." 2015-07-30 16:50:15 +00:00
socket_inaddr_any_server_unix.c libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
socket_inaddr_any_server_windows.c libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
socket_local_client_unix.c libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
socket_local_server_unix.c libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
socket_local_unix.h libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
socket_loopback_client_unix.c libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
socket_loopback_server_unix.c libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
socket_network_client_unix.c libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
socket_network_client_windows.c libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
sockets.cpp libcutils: add socket_get_local_port(). 2016-02-02 09:52:02 -08:00
sockets_unix.cpp libcutils/fastboot: improve multi-buffer write. 2016-02-03 10:01:38 -08:00
sockets_windows.cpp libcutils/fastboot: improve multi-buffer write. 2016-02-03 10:01:38 -08:00
str_parms.c Suppress false positive memory leak warnings. 2016-02-04 16:38:04 -08:00
strdup8to16.c auto import from //branches/cupcake_rel/...@138607 2009-03-13 13:04:37 -07:00
strdup16to8.c strdup16to8.c: fix benign integer underflow. 2015-08-27 10:30:50 -07:00
strlcpy.c Fix Windows strlcpy.c build. 2015-04-02 17:21:47 -07:00
threads.c Remove libbacktrace definition of gettid. 2015-05-13 13:44:34 -07:00
trace-dev.c Fix incorrect handling of snprintf return value. 2016-02-25 12:46:44 -08:00
trace-host.c Move trace.h to stdatomic. 2015-04-16 10:41:16 -07:00
uevent.c More SOCK_CLOEXEC 2015-02-26 13:32:52 -08:00