diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index f7bfc6cb59..a5f8d8d11f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2898,7 +2898,7 @@ static int show_reg_callback_xml(void *pArg, int argc, char **argv, char **colum cb->stream->write_function(cb->stream, " %s\n", switch_str_nil(argv[0])); cb->stream->write_function(cb->stream, " %s@%s\n", switch_str_nil(argv[1]), switch_str_nil(argv[2])); cb->stream->write_function(cb->stream, " %s\n", switch_amp_encode(switch_str_nil(argv[3]), xmlbuf, buflen)); - cb->stream->write_function(cb->stream, " %s\n", switch_str_nil(argv[7])); + cb->stream->write_function(cb->stream, " %s\n", switch_amp_encode(switch_str_nil(argv[7]), xmlbuf, buflen)); cb->stream->write_function(cb->stream, " %s(%s) exp(%s) expsecs(%d)\n", switch_str_nil(argv[4]), switch_str_nil(argv[5]), exp_buf, exp_secs); cb->stream->write_function(cb->stream, " %s\n", switch_str_nil(argv[11])); diff --git a/src/switch_utils.c b/src/switch_utils.c index d877061e39..3961d89089 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -463,6 +463,42 @@ SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len) for (p = s; x < len; p++) { switch (*p) { + + case '"': + if (x + 6 > len - 1) { + goto end; + } + *q++ = '&'; + *q++ = 'q'; + *q++ = 'u'; + *q++ = 'o'; + *q++ = 't'; + *q++ = ';'; + x += 6; + break; + case '\'': + if (x + 6 > len - 1) { + goto end; + } + *q++ = '&'; + *q++ = 'a'; + *q++ = 'p'; + *q++ = 'o'; + *q++ = 's'; + *q++ = ';'; + x += 6; + break; + case '&': + if (x + 5 > len - 1) { + goto end; + } + *q++ = '&'; + *q++ = 'a'; + *q++ = 'm'; + *q++ = 'p'; + *q++ = ';'; + x += 5; + break; case '<': if (x + 4 > len - 1) { goto end;