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
master
Steve Markgraf 3 years ago
parent 81833a1cf6
commit 3c263b7451
  1. 6
      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)

Loading…
Cancel
Save