From 7353f883cd81602590404482770ff2b967722133 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Tue, 15 May 2018 12:50:19 +0530 Subject: [PATCH] qcacld-3.0: Avoid NULL pointer access in get version api There is a possibility of NULL pointer access in hdd_wlan_get_version api as the check for the version pointer and version len is incorrect. If the version pointer is NULL and version_len is non zero, it will result in NULL pointer derefernce. To address this issue update the NULL pointer check to return in both the cases whether the pointer is NULL or the version_len is NULL. Change-Id: Iee3ef6d31fac1b5ede4ac3a762157d3c48d5ffc5 CRs-Fixed: 2242148 --- core/hdd/src/wlan_hdd_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 2b0fe0d5574d..4fff2e447861 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2482,7 +2482,7 @@ uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx, return 0; } - if (!version && version_len == 0) { + if (!version || version_len == 0) { hdd_err("Invalid buffer pointr or buffer len\n"); return 0; }