summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-01-26 06:53:56 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-01-26 06:53:56 +0200
commit90d1acd4a88822675208f5e1d445b5017f7cbfb8 (patch)
tree3dd241e86a91bcb165418613188d31660e27a2c1
parentf77783568b02a3869e9f7d0e6fa918eadd98b506 (diff)
InputWidget: Optional domain punycoding for UI
-rw-r--r--src/app.c5
-rw-r--r--src/ui/inputwidget.c10
2 files changed, 10 insertions, 5 deletions
diff --git a/src/app.c b/src/app.c
index ec2f4b5b..5d27618b 100644
--- a/src/app.c
+++ b/src/app.c
@@ -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
226void setText_InputWidget(iInputWidget *d, const iString *text) { 226void 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) {