diff options
author | Erik Kline <ek@google.com> | 2014-11-15 04:24:40 +0900 |
---|---|---|
committer | Natalie Silvanovich <natashenka@google.com> | 2014-12-12 18:53:52 +0000 |
commit | ab76087921df3dde0c28776d31d7e6873aec9609 (patch) | |
tree | 180bf7d59c7f19e46f446dc72909d7af0236b059 /Android.mk | |
parent | 40d921b22a5c878d64b17a1138477e0eeb37842e (diff) | |
download | android_external_dhcpcd-ab76087921df3dde0c28776d31d7e6873aec9609.tar.gz android_external_dhcpcd-ab76087921df3dde0c28776d31d7e6873aec9609.tar.bz2 android_external_dhcpcd-ab76087921df3dde0c28776d31d7e6873aec9609.zip |
Fun with buffer overrruns.
In get_option(): don't read past the end of the option buffer.
Also add a small unittest to verify sane behaviour for the above.
The dhcpcd code is not easily refactored into a library, nor is it
entirely possible to include some header files directly since some
structures use C++ reserved keywords ("new") for variable names.
In print_option(): use of snprintf() returns the length that
/would/ have been written. Add checks that the output buffer
is not overrun when printing.
Bug: 18356137
Bug: 18356135
Change-Id: I0f907b8a952208749226ba034a416d773e068f8a
(cherry picked from commit c1c270dba20afa63a5b7769646cf721d0fa7c431)
Diffstat (limited to 'Android.mk')
-rw-r--r-- | Android.mk | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -57,3 +57,11 @@ LOCAL_MODULE_CLASS := ETC LOCAL_MODULE_PATH := $(hooks_target) LOCAL_SRC_FILES := $(hooks_dir)/$(LOCAL_MODULE) include $(BUILD_PREBUILT) + +# Unit tests. +include $(CLEAR_VARS) +LOCAL_MODULE := dhcpcd_test +LOCAL_CFLAGS := -Wall -Werror -Wunused-parameter +LOCAL_SRC_FILES := dhcpcd_test.cpp dhcp.c common.c +LOCAL_MODULE_TAGS := eng tests +include $(BUILD_NATIVE_TEST) |