diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2012-08-09 11:43:53 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-08-09 11:43:53 -0700 |
commit | dec333941efd5290629bd5a0197929e671e06291 (patch) | |
tree | e9838506a6330e6322160c8958e1f0ba8a40806e | |
parent | 3432a870d42a033da57775f04297ed6f4a04efba (diff) | |
parent | 332e8babe350433b320efc9484f15a5dbdd8c68f (diff) | |
download | extras-dec333941efd5290629bd5a0197929e671e06291.tar.gz |
am 332e8bab: Merge "Avoid dereferencing NULL pointer with memcmp in the test code."
* commit '332e8babe350433b320efc9484f15a5dbdd8c68f':
Avoid dereferencing NULL pointer with memcmp in the test code.
-rw-r--r-- | tests/bionic/libc/common/test_libgen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/bionic/libc/common/test_libgen.c b/tests/bionic/libc/common/test_libgen.c index 4a2c29e2..fd85816e 100644 --- a/tests/bionic/libc/common/test_libgen.c +++ b/tests/bionic/libc/common/test_libgen.c @@ -76,7 +76,7 @@ test_basename_r(char* _input, const char* _expected_content, int _expected, c return; } } - else if ( memcmp( _buff, _expected_content, ret ) ) { + else if (_buff != NULL && memcmp( _buff, _expected_content, ret ) ) { fprintf(stderr, "KO: basename_r(\"%s\", <buff>, %d) returned \"%s\", expected \"%s\"\n", _input, _bufflen, _buff, _expected_content ); @@ -109,7 +109,7 @@ test_dirname_r(char* _input, const char* _expected_content, int _expected, ch return; } } - else if ( memcmp( _buff, _expected_content, ret ) ) { + else if (_buff != NULL && memcmp( _buff, _expected_content, ret ) ) { fprintf(stderr, "KO: dirname_r(\"%s\", <buff>, %d) returned \"%s\", expected \"%s\"\n", _input, _bufflen, _buff, _expected_content ); |