فهرست منبع

Merge pull request #334 from a1akris/fix/331/strlen

Fix strlen buffer overrun
Tomás Pinho 2 سال پیش
والد
کامیت
b5b8a5c1b8
3فایلهای تغییر یافته به همراه8 افزوده شده و 4 حذف شده
  1. 0 4
      core/rtw_rf.c
  2. 4 0
      include/hal_data.h
  3. 4 0
      include/rtw_rf.h

+ 0 - 4
core/rtw_rf.c

@@ -1050,12 +1050,8 @@ void rtw_txpwr_lmt_add_with_nlen(struct rf_ctl_t *rfctl, const char *regd_name,
 		ent = LIST_CONTAINOR(cur, struct txpwr_lmt_ent, list);
 		cur = get_next(cur);
 
-		#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 1))
-		if (_rtw_memcmp(ent->regd_name, regd_name, nlen) == _TRUE)
-		#else
 		if (strlen(ent->regd_name) == nlen
 			&& _rtw_memcmp(ent->regd_name, regd_name, nlen) == _TRUE)
-		#endif
 			goto chk_lmt_val;
 	}
 

+ 4 - 0
include/hal_data.h

@@ -332,7 +332,11 @@ struct txpwr_lmt_ent {
 		[MAX_TX_COUNT];
 #endif
 
+	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0))
+	char regd_name[];
+	#else
 	char regd_name[0];
+	#endif
 };
 #endif /* CONFIG_TXPWR_LIMIT */
 

+ 4 - 0
include/rtw_rf.h

@@ -173,7 +173,11 @@ struct regd_exc_ent {
 	_list list;
 	char country[2];
 	u8 domain;
+	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0))
+	char regd_name[];
+	#else
 	char regd_name[0];
+	#endif
 };
 
 void dump_regd_exc_list(void *sel, struct rf_ctl_t *rfctl);