diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2013-03-22 16:15:19 +0200 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-03-22 16:21:28 +0200 |
commit | 9944240ba52d19f04fb4bf468a8524f570e5fa6d (patch) | |
tree | fab621f9104ddf14cbadf9ced12f648857fef2cd | |
parent | fd7600c2cbebb377124d1aab6a4a2eecc46e14d1 (diff) | |
download | connman-9944240ba52d19f04fb4bf468a8524f570e5fa6d.tar.gz connman-9944240ba52d19f04fb4bf468a8524f570e5fa6d.tar.bz2 connman-9944240ba52d19f04fb4bf468a8524f570e5fa6d.zip |
dnsproxy: Make sure we are not accessing null hash
If dnsproxy is not in use, like when connman has been started
with -r option, then the listener_table will be NULL which can
cause crash in hash table lookup call.
-rw-r--r-- | src/dnsproxy.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dnsproxy.c b/src/dnsproxy.c index f698cfde..7a9ca910 100644 --- a/src/dnsproxy.c +++ b/src/dnsproxy.c @@ -2916,6 +2916,9 @@ int __connman_dnsproxy_add_listener(int index) if (index < 0) return -EINVAL; + if (listener_table == NULL) + return 0; + if (g_hash_table_lookup(listener_table, GINT_TO_POINTER(index)) != NULL) return 0; @@ -2947,6 +2950,9 @@ void __connman_dnsproxy_remove_listener(int index) DBG("index %d", index); + if (listener_table == NULL) + return; + ifdata = g_hash_table_lookup(listener_table, GINT_TO_POINTER(index)); if (ifdata == NULL) return; |