File rtl-sdr-0004-fix-rtl_eeprom-warnings.patch of Package rtl-sdr

From 3c263b745121d9f4df95fd06910a00eba98a2f11 Mon Sep 17 00:00:00 2001
From: Steve Markgraf <steve@steve-m.de>
Date: Fri, 1 Nov 2019 02:18:54 +0100
Subject: [PATCH] rtl_eeprom: fix warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Account for \0 string terminator when calling strncpy().

Fixes the following GCC 9 warning:
warning: ‘__builtin_strncpy’ specified
bound 256 equals destination size
---
 src/rtl_eeprom.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/rtl_eeprom.c b/src/rtl_eeprom.c
index f562d73..24be900 100644
--- a/src/rtl_eeprom.c
+++ b/src/rtl_eeprom.c
@@ -370,14 +370,14 @@ int main(int argc, char **argv)
 	}
 
 	if (manuf_str)
-		strncpy((char*)&conf.manufacturer, manuf_str, MAX_STR_SIZE);
+		strncpy((char*)&conf.manufacturer, manuf_str, MAX_STR_SIZE - 1);
 
 	if (product_str)
-		strncpy((char*)&conf.product, product_str, MAX_STR_SIZE);
+		strncpy((char*)&conf.product, product_str, MAX_STR_SIZE - 1);
 
 	if (serial_str) {
 		conf.have_serial = 1;
-		strncpy((char*)&conf.serial, serial_str, MAX_STR_SIZE);
+		strncpy((char*)&conf.serial, serial_str, MAX_STR_SIZE - 1);
 	}
 
 	if (ir_endpoint != 0)
openSUSE Build Service is sponsored by