Переглянути джерело

Attempts a fix at a buffer overflow found in kernels > 6.5.1

Tomás Pinho 2 роки тому
батько
коміт
2286e78e79
1 змінених файлів з 4 додано та 0 видалено
  1. 4 0
      core/rtw_rf.c

+ 4 - 0
core/rtw_rf.c

@@ -1050,8 +1050,12 @@ 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;
 	}