Merge branch 'lineage-21.0-caf' of https://github.com/LineageOS/android_hardware_qcom_wlan into leaf-3.2-caf

Change-Id: I20262a2f124362f9e85532bf4011e8d2cc6c6786
diff --git a/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c b/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c
index daced34..a540884 100644
--- a/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c
+++ b/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211.c
@@ -3899,16 +3899,19 @@
 
 char *result_copy_to_buf(char *src, char *dst_buf, int *dst_len)
 {
-	int str_len, remaining = 0;
+	size_t str_len, remaining = 0;
+
+	if (!dst_buf || *dst_len < 0)
+		return NULL;
 
 	remaining = *dst_len;
 	str_len = strlen(src);
-	remaining = remaining - (str_len + 1);
 
-	if (remaining <= 0) {
-		wpa_printf(MSG_ERROR, "destination buffer length not enough");
+	if (remaining > 0 && (remaining - 1) > str_len)
+		remaining = remaining - (str_len + 1);
+	else
 		return NULL;
-	}
+
 	os_memcpy(dst_buf, src, str_len);
 
 	*dst_len = remaining;
diff --git a/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211_sr.c b/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211_sr.c
index d0cb989..47e26e7 100644
--- a/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211_sr.c
+++ b/qcwcn/wpa_supplicant_8_lib/driver_cmd_nl80211_sr.c
@@ -343,11 +343,7 @@
 			cmd += 21;
 			cmd = skip_white_space(cmd);
 			pd_thres = get_s32_from_string(cmd, &ret);
-			/**
-			 * For non-SRG OBSS, allowed range for PD threshold
-			 * is -62 to -81 as -82 is fixed as min offset.
-			 **/
-			if (ret < 0 || pd_thres <= OBSS_PD_THRESHOLD_MIN ||
+			if (ret < 0 || pd_thres < OBSS_PD_THRESHOLD_MIN ||
 			    pd_thres > OBSS_PD_THRESHOLD_MAX) {
 				wpa_printf(MSG_ERROR, "Invalid Non-SRG PD threshold: %d", pd_thres);
 				return -EINVAL;