bug 898221 - search backwards for the last punycode delimiter instead of forwards. r=hurley

This commit is contained in:
pchang9@cs.wisc.edu 2013-07-30 13:01:11 -07:00
parent db283de51f
commit 98e52ccb66

View File

@ -215,7 +215,12 @@ enum punycode_status punycode_decode(
/* points before the last delimiter, or 0 if there is none, then */
/* copy the first b code points to the output. */
for (b = j = 0; j < input_length; ++j) if (delim(input[j])) b = j;
for (b = 0, j = input_length - 1 ; j > 0; --j) {
if (delim(input[j])) {
b = j;
break;
}
}
if (b > max_out) return punycode_big_output;
for (j = 0; j < b; ++j) {