crda: Fix buffer overflow in sscanf

Fixes build with clang14

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2022-02-04 09:26:36 -08:00
parent 9eb9b02dc5
commit 95f7f8c51d
2 changed files with 32 additions and 0 deletions
@@ -0,0 +1,31 @@
From 078e962d345fd0536fe7ba797485ee1a4159c032 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 4 Feb 2022 09:18:30 -0800
Subject: [PATCH] Make alpha2 to be 3 characters long
Fixes buffer overflow
reglib.c:969:9: error: 'sscanf' may overflow; destination buffer in argument 3 has size 2, but the corresponding specifier may require size 3 [-Werror,-Wfortify-source]
alpha2,
^
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
reglib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/reglib.c b/reglib.c
index e00e9b8..8565a0b 100644
--- a/reglib.c
+++ b/reglib.c
@@ -958,7 +958,7 @@ reglib_parse_rules(FILE *fp, struct ieee80211_regdomain *trd)
static int reglib_parse_country_dfs(char *line, struct ieee80211_regdomain *rd)
{
char dfs_region_alpha[9];
- char alpha2[2];
+ char alpha2[3];
int hits;
memset(rd, 0, sizeof(*rd));
--
2.35.1
@@ -15,6 +15,7 @@ SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz \
file://use-target-word-size-instead-of-host-s.patch \
file://fix-issues-when-USE_OPENSSL-1.patch \
file://crda-4.14-python-3.patch \
file://0001-Make-alpha2-to-be-3-characters-long.patch \
"
SRC_URI[md5sum] = "0431fef3067bf503dfb464069f06163a"
SRC_URI[sha256sum] = "43fcb9679f8b75ed87ad10944a506292def13e4afb194afa7aa921b01e8ecdbf"