Browse Source

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>
v9.x-staging
Rimas Misevičius 7 years ago
committed by James M Snell
parent
commit
09b703bd3c
  1. 2
      src/node_url.cc

2
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]) ||

Loading…
Cancel
Save