Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRimas Misevičius <rmisev3@gmail.com>2017-09-27 11:51:35 +0300
committerJames M Snell <jasnell@gmail.com>2017-09-29 19:25:19 +0300
commit09b703bd3c903e246b31bf4cf4ae1cb7dfd51089 (patch)
tree175d3596500bb4275064cc8031609bc6d69367e3 /src/node_url.cc
parente0edb007623c6168531e8f1cf7050477ca89d74e (diff)
url: fix remaining calculation
Fix remaining calculation in the PercentDecode function to match the definition in URL standard: https://url.spec.whatwg.org/#remaining PR-URL: https://github.com/nodejs/node/pull/15637 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'src/node_url.cc')
-rw-r--r--src/node_url.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_url.cc b/src/node_url.cc
index e23c1e6cbf2..c8a4427eb60 100644
--- a/src/node_url.cc
+++ b/src/node_url.cc
@@ -518,7 +518,7 @@ static inline void PercentDecode(const char* input,
while (pointer < end) {
const char ch = pointer[0];
- size_t remaining = (end - pointer) + 1;
+ const size_t remaining = end - pointer - 1;
if (ch != '%' || remaining < 2 ||
(ch == '%' &&
(!IsASCIIHexDigit(pointer[1]) ||