adafruit/Adafruit_GPS

string parsing error with GPS_HardwareSerial_Parsing.ino example

Opened this issue · 0 comments

  • Arduino board: Adafruit Feather NRF52840 Express(4062) with Adafruit Ultimate GPS Feather Wing(3133)

  • Arduino IDE version (found in Arduino -> About Arduino menu): 2.0.3

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Example sketch "GPS_HardwareSerial_Parsing" yields the following errors when trying to compile

c:\Users\xxx\Documents\Arduino\libraries\Adafruit_GPS_Library\src\NMEA_build.cpp: In member function 'char* Adafruit_GPS::build(char*, const char*, const char*, char, bool)':
c:\Users\xxx\Documents\Arduino\libraries\Adafruit_GPS_Library\src\NMEA_build.cpp:76:10: warning: 'char* strncpy(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Wstringop-overflow=]
76 | strncpy(p, thisSource, strlen(thisSource));
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\Users\xxx\Documents\Arduino\libraries\Adafruit_GPS_Library\src\NMEA_build.cpp:78:10: warning: 'char* strncpy(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Wstringop-overflow=]
78 | strncpy(p, thisSentence, strlen(thisSentence));
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In member function 'char* Adafruit_GPS::parseStr(char*, char*, int)',
inlined from 'char* Adafruit_GPS::parseStr(char*, char*, int)' at c:\Users\xxx\Documents\Arduino\libraries\Adafruit_GPS_Library\src\NMEA_parse.cpp:751:7:
c:\Users\xxx\Documents\Arduino\libraries\Adafruit_GPS_Library\src\NMEA_parse.cpp:766:14: warning: 'char* strncpy(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Wstringop-overflow=]
766 | strncpy(buff, p, len); // or to the end or max capacity
| ~~~~~~~^~~~~~~~~~~~~~
c:\Users\xxx\Documents\Arduino\libraries\Adafruit_GPS_Library\src\NMEA_parse.cpp: In member function 'char* Adafruit_GPS::parseStr(char*, char*, int)':
c:\Users\xxx\Documents\Arduino\libraries\Adafruit_GPS_Library\src\NMEA_parse.cpp:765:28: note: length computed here
765 | len = min((int)strlen(p), n - 1);
| ~~~~~~^~~