Просмотр исходного кода

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
Ashish Kumar Dhanotiya 7 лет назад
Родитель
Сommit
7353f883cd
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      core/hdd/src/wlan_hdd_main.c

+ 1 - 1
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;
 	}