From e37020553e2e8b087807931090605b61ff8b2e85 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 29 Sep 2008 17:03:53 +0000 Subject: [PATCH] When making a file:// URL, additionally percent-escape the percent character itself. Also fix a signedness warning. --- NmapOps.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NmapOps.cc b/NmapOps.cc index d8ee0bc08..708c300cb 100644 --- a/NmapOps.cc +++ b/NmapOps.cc @@ -190,9 +190,9 @@ char *filename_to_url(const char *filename) { #endif /* Percent-encode any troublesome characters. */ - int i = 0; + unsigned int i = 0; /* See RFC 3986, section 3.3 "Path" for allowed characters. */ - while ((i = url.find_first_of("?#[]", i)) != std::string::npos) { + while ((i = url.find_first_of("?#[]%", i)) != std::string::npos) { Snprintf(percent_buffer, sizeof(percent_buffer), "%%%02X", url[i]); url.replace(i, 1, percent_buffer); i += strlen(percent_buffer);