From b8fdecbfd0a0cdbbb17b902a6be87c84227b9b11 Mon Sep 17 00:00:00 2001
From: Sasha Levitskiy <sanek@google.com>
Date: Thu, 25 Oct 2012 15:07:02 -0700
Subject: Add parameter checking and error reporting to wpa_blacklist API.

Bug: 7423119
Change-Id: Iae85361aa0dc94a75bffd07deef451c85e3d9d96
Signed-off-by: Sasha Levitskiy <sanek@google.com>
---
 wpa_supplicant/blacklist.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/wpa_supplicant/blacklist.c b/wpa_supplicant/blacklist.c
index fa8014c..2e01e7f 100644
--- a/wpa_supplicant/blacklist.c
+++ b/wpa_supplicant/blacklist.c
@@ -23,6 +23,9 @@ struct wpa_blacklist * wpa_blacklist_get(struct wpa_supplicant *wpa_s,
 {
 	struct wpa_blacklist *e;
 
+	if (wpa_s == NULL || bssid == NULL)
+		return NULL;
+
 	e = wpa_s->blacklist;
 	while (e) {
 		if (os_memcmp(e->bssid, bssid, ETH_ALEN) == 0)
@@ -54,6 +57,9 @@ int wpa_blacklist_add(struct wpa_supplicant *wpa_s, const u8 *bssid)
 {
 	struct wpa_blacklist *e;
 
+	if (wpa_s == NULL || bssid == NULL)
+		return -1;
+
 	e = wpa_blacklist_get(wpa_s, bssid);
 	if (e) {
 		e->count++;
@@ -87,6 +93,9 @@ int wpa_blacklist_del(struct wpa_supplicant *wpa_s, const u8 *bssid)
 {
 	struct wpa_blacklist *e, *prev = NULL;
 
+	if (wpa_s == NULL || bssid == NULL)
+		return -1;
+
 	e = wpa_s->blacklist;
 	while (e) {
 		if (os_memcmp(e->bssid, bssid, ETH_ALEN) == 0) {
-- 
cgit v1.1