From 69ef4c2375b5110886b08957cd2305ce8aa8eb32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 7 Sep 2020 15:50:19 +0200 Subject: [PATCH] url: verify domain is not empty after "ToASCII" Port of https://github.com/whatwg/url/pull/497 PR-URL: https://github.com/nodejs/node/pull/33770 Reviewed-By: Daijiro Wachi Reviewed-By: Shingo Inoue Reviewed-By: Rich Trott Reviewed-By: Joyee Cheung --- src/node_url.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node_url.cc b/src/node_url.cc index 8e6906790a3752..b7aeb8b006284f 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -779,6 +779,8 @@ bool ToASCII(const std::string& input, std::string* output) { MaybeStackBuffer buf; if (i18n::ToASCII(&buf, input.c_str(), input.length()) < 0) return false; + if (buf.length() == 0) + return false; output->assign(*buf, buf.length()); return true; }