rtl_eeprom: fix warnings

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

Fixes the following GCC 9 warning:
warning: ‘__builtin_strncpy’ specified
bound 256 equals destination size
This commit is contained in:
Steve Markgraf 2019-11-01 02:18:54 +01:00
parent 81833a1cf6
commit 3c263b7451
1 changed files with 3 additions and 3 deletions

View File

@ -370,14 +370,14 @@ int main(int argc, char **argv)
} }
if (manuf_str) 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) 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) { if (serial_str) {
conf.have_serial = 1; 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) if (ir_endpoint != 0)