diff options
-rw-r--r-- | src/app.c | 5 | ||||
-rw-r--r-- | src/ui/inputwidget.c | 10 |
2 files changed, 10 insertions, 5 deletions
@@ -1207,11 +1207,6 @@ iBool handleCommand_App(const char *cmd) { | |||
1207 | else { | 1207 | else { |
1208 | urlEncodePath_String(url); | 1208 | urlEncodePath_String(url); |
1209 | } | 1209 | } |
1210 | |||
1211 | /* Prevent address bar spoofing (mentioned as IDN homograph attack | ||
1212 | in issue 73) */ | ||
1213 | punyEncodeUrlHost_String(url); | ||
1214 | |||
1215 | setUrlFromCache_DocumentWidget(doc, url, isHistory); | 1210 | setUrlFromCache_DocumentWidget(doc, url, isHistory); |
1216 | /* Optionally, jump to a text in the document. This will only work if the document | 1211 | /* Optionally, jump to a text in the document. This will only work if the document |
1217 | is already available, e.g., it's from "about:" or restored from cache. */ | 1212 | is already available, e.g., it's from "about:" or restored from cache. */ |
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index 6992bbec..62f0341e 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -224,6 +224,16 @@ static void updateBuffered_InputWidget_(iInputWidget *d) { | |||
224 | } | 224 | } |
225 | 225 | ||
226 | void setText_InputWidget(iInputWidget *d, const iString *text) { | 226 | void setText_InputWidget(iInputWidget *d, const iString *text) { |
227 | if (d->inFlags & isUrl_InputWidgetFlag) { | ||
228 | /* If user wants URLs encoded, also Punycode the domain. */ | ||
229 | if (!prefs_App()->decodeUserVisibleURLs) { | ||
230 | iString *enc = collect_String(copy_String(text)); | ||
231 | /* Prevent address bar spoofing (mentioned as IDN homograph attack in | ||
232 | https://github.com/skyjake/lagrange/issues/73) */ | ||
233 | punyEncodeUrlHost_String(enc); | ||
234 | text = enc; | ||
235 | } | ||
236 | } | ||
227 | clearUndo_InputWidget_(d); | 237 | clearUndo_InputWidget_(d); |
228 | clear_Array(&d->text); | 238 | clear_Array(&d->text); |
229 | iConstForEach(String, i, text) { | 239 | iConstForEach(String, i, text) { |