summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChinh Tran <chinht@codeaurora.org>2010-09-17 14:29:02 -0700
committerChinh Tran <chinht@codeaurora.org>2010-09-17 14:29:02 -0700
commit9618674f412a45d294e5941e9442c9496ddc73b1 (patch)
treea814309f6de9eab0b1a9f420c791facd5c382120
parent74ba18baa02f9b02d2ffc07f6f05cbba8f9c9598 (diff)
downloadandroid_external_connectivity-9618674f412a45d294e5941e9442c9496ddc73b1.tar.gz
android_external_connectivity-9618674f412a45d294e5941e9442c9496ddc73b1.tar.bz2
android_external_connectivity-9618674f412a45d294e5941e9442c9496ddc73b1.zip
external/connectivity: Check for null string before strcmp
The strcmp function with null string causes a crash. This occurs when an entry is added to routing table that has a null interface. Change-Id: I919975c8ab114000c1ae67a0a867e15f9934e21a CRs-fixed: 253597
-rwxr-xr-xcnd/src/cnd_iproute2.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/cnd/src/cnd_iproute2.cpp b/cnd/src/cnd_iproute2.cpp
index 590bcdb..5fa750a 100755
--- a/cnd/src/cnd_iproute2.cpp
+++ b/cnd/src/cnd_iproute2.cpp
@@ -81,7 +81,10 @@ enum Cmd_line_actions
struct routingTableMapComparator {
bool operator() (const uint8_t *string1, const uint8_t *string2) const
{
- return (strcmp((char *)string1, (char *)string2) < 0);
+ if (string1 && string2) {
+ return (strcmp((char *)string1, (char *)string2) < 0);
+ }
+ return false;
}
};