ChuckBell / MySQL_Connector_Arduino

Database connector library for using MySQL with your Arduino projects.
332 stars 133 forks source link

Compiler warning on ESP8266 #188

Open Sprinkle-Master opened 2 years ago

Sprinkle-Master commented 2 years ago

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);