Skip to content

Commit

Permalink
url: fix remaining calculation
Browse files Browse the repository at this point in the history
Fix remaining calculation in the PercentDecode function to match the
definition in URL standard: https://url.spec.whatwg.org/#remaining

PR-URL: #15637
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
  • Loading branch information
rmisev authored and jasnell committed Sep 29, 2017
1 parent e0edb00 commit 09b703b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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]) ||
Expand Down

0 comments on commit 09b703b

Please sign in to comment.