MySQL_Connector_Arduino
MySQL_Connector_Arduino copied to clipboard
Compiler warning on ESP8266
Truncated output from MySQL_Cursor.cpp on line 389 Compiling for ESP8266 with MySQL Connector Arduino v1.2.0 Arduino IDE successfully compiled with the following warning:
\\rs.local\home\Projects_Computing\Arduino\Sketches\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp: In member function 'char* MySQL_Cursor::read_string(int*)':
\\rs.local\home\Projects_Computing\Arduino\Sketches\libraries\MySQL_Connector_Arduino\src\MySQL_Cursor.cpp:389:12: warning: 'char* strncpy(char*, const char*, size_t)' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
389 | strncpy(str, "NULL", 4);
| ~~~~~~~^~~~~~~~~~~~~~~~
I changed line 389 to include a null character after the word "NULL" and it seams to have cleared the compiler error. Hopefully this was the intent and doesn't generate any abnormal behavior.
strncpy(str, "NULL", 5);