adafruit / Adafruit_GPS

An interrupt-based GPS Arduino library for no-parsing-required use
Other
469 stars 318 forks source link

string parsing error with GPS_HardwareSerial_Parsing.ino example #144

Open tonysunshine opened 1 year ago

tonysunshine commented 1 year ago

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