diff --git a/src/gtk/utilities.c b/src/gtk/utilities.c
index 6b833f021..6be49e024 100644
--- a/src/gtk/utilities.c
+++ b/src/gtk/utilities.c
@@ -1304,16 +1304,28 @@ HtmlOutput(char *text, GtkWidget *gtkText, MOD_FONT *mf, char *anchor)
// untrusted BibleSync navigation packets whose ref
// field carries the '#' fragment; without escaping a
// crafted value can break out of the string and inject
- // script into the WebKit view.
+ // script into the WebKit view. g_strescape escapes
+ // backslash, double-quote, and C0 control bytes but
+ // leaves '<', '>', and '/' untouched, so a value of
+ // "" would end the
+ // inline ",
- esc_anchor);
- g_free(esc_anchor);
+ safe_anchor);
+ g_free(safe_anchor);
XIPHOS_HTML_WRITE(html, buf, strlen(buf));
g_free(buf);
}