mirror of
https://github.com/nmap/nmap.git
synced 2025-12-25 17:09:02 +00:00
Index the URL string with a std::string::size_type rather than an unsigned int.
Fyodor got the warning NmapOps.cc: In function âchar* filename_to_url(const char*)â: NmapOps.cc:195: warning: comparison is always true due to limited range of data type and later a segmentation fault.
This commit is contained in:
@@ -190,7 +190,7 @@ char *filename_to_url(const char *filename) {
|
||||
#endif
|
||||
|
||||
/* Percent-encode any troublesome characters. */
|
||||
unsigned int i = 0;
|
||||
std::string::size_type i = 0;
|
||||
/* See RFC 3986, section 3.3 "Path" for allowed characters. */
|
||||
while ((i = url.find_first_of("?#[]%", i)) != std::string::npos) {
|
||||
Snprintf(percent_buffer, sizeof(percent_buffer), "%%%02X", url[i]);
|
||||
|
||||
Reference in New Issue
Block a user