From: Walter Doekes Date: Fri, 11 Nov 2011 21:21:58 +0000 (+0000) Subject: Fix bad quoting of multiline mxml opaque_data that caused invalid xml. X-Git-Tag: 1.8.9.0-rc1~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a32aae339b0aca84ff06270037128800010ef47;p=thirdparty%2Fasterisk.git Fix bad quoting of multiline mxml opaque_data that caused invalid xml. The opaque_data was added and enclosed in single quotes, assuming it would be only a single line. The rest of the lines were appended after the closing quote. (closes issue ASTERISK-18852) Reported by: peep_ on IRC Review: https://reviewboard.asterisk.org/r/1577 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@344835 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/manager.c b/main/manager.c index a3bbabf9cb..b2c1bfcc4e 100644 --- a/main/manager.c +++ b/main/manager.c @@ -5600,9 +5600,10 @@ static void xml_translate(struct ast_str **out, char *in, struct ast_variable *g } if (in_data) { - /* Process data field in Opaque mode */ - xml_copy_escape(out, val, 0); /* data field */ + /* Process data field in Opaque mode. This is a + * followup, so we re-add line feeds. */ ast_str_append(out, 0, xml ? "\n" : "
\n"); + xml_copy_escape(out, val, 0); /* data field */ continue; } @@ -5638,7 +5639,9 @@ static void xml_translate(struct ast_str **out, char *in, struct ast_variable *g ao2_ref(vc, -1); ast_str_append(out, 0, xml ? "='" : ""); xml_copy_escape(out, val, 0); /* data field */ - ast_str_append(out, 0, xml ? "'" : "\n"); + if (!in_data || !*in) { + ast_str_append(out, 0, xml ? "'" : "\n"); + } } if (inobj) {