[balsa/gtk3] Replace "&" by "&" in marked-up string



commit ee38af3dd8e5273aba877f33eaab8bd05e1b8fa1
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Sep 30 19:47:59 2012 -0400

    Replace "&" by "&amp;" in marked-up string
    
    	* libbalsa/libbalsa.c (ask_cert_real): replace "&" by "&amp;" in
    	marked-up string.

 ChangeLog           |    5 +++++
 libbalsa/libbalsa.c |   10 ++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7f061e3..7601f9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-30  Peter Bloomfield
+
+	* libbalsa/libbalsa.c (ask_cert_real): replace "&" by "&amp;" in
+	marked-up string.
+
 2012-09-17  Peter Bloomfield
 
 	Fix bgo #684124
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 0407cc4..25ab944 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -576,6 +576,16 @@ ask_cert_real(void *data)
     g_string_append(str, c); g_free(c);
     g_free(valid_from); g_free(valid_until);
 
+    /* This string uses markup, so we must replace "&" with "&amp;" */
+    c = str->str;
+    while ((c = strchr(c, '&'))) {
+        gssize pos;
+
+        pos = (c - str->str) + 1;
+        g_string_insert(str, pos, "amp;");
+        c = str->str + pos;
+    }
+
     dialog = gtk_dialog_new_with_buttons(_("SSL/TLS certificate"), NULL,
                                          GTK_DIALOG_MODAL,
                                          _("_Accept Once"), 0,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]