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 <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
  • Loading branch information
rmisev authored and MylesBorins committed Oct 11, 2017
1 parent 7e1003a commit 1cc4245
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 1cc4245

Please sign in to comment.