1
0
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:
david
2008-09-29 21:44:12 +00:00
parent e37020553e
commit e0870ade30

View File

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