res_pjsip_pidf_body_generator / res_pjsip_xpidf_body_generator: Ensure local entity...
authorJoshua Colp <jcolp@digium.com>
Tue, 29 Jul 2014 09:54:24 +0000 (09:54 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 29 Jul 2014 09:54:24 +0000 (09:54 +0000)
The local entity as provided by PJSIP is quoted within '<' and '>'. As a result placing
this value into XML will result in malformed XML being produced. This patch now unquotes
the local entity so it can go safely into the XML.

Review: https://reviewboard.asterisk.org/r/3851/
........

Merged revisions 419750 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419751 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_pjsip_pidf_body_generator.c
res/res_pjsip_xpidf_body_generator.c

index 5d931e9..b3164a2 100644 (file)
 static void *pidf_allocate_body(void *data)
 {
        struct ast_sip_exten_state_data *state_data = data;
+       char *local = ast_strdupa(state_data->local);
        pjpidf_pres *pres;
        pj_str_t entity;
 
-       pres = pjpidf_create(state_data->pool, pj_cstr(&entity, state_data->local));
+       pres = pjpidf_create(state_data->pool, pj_cstr(&entity, ast_strip_quoted(local, "<", ">")));
 
        return pres;
 }
index 98461a7..4e0587d 100644 (file)
 static void *xpidf_allocate_body(void *data)
 {
        struct ast_sip_exten_state_data *state_data = data;
+       char *local = ast_strdupa(state_data->local);
        pjxpidf_pres *pres;
        pj_str_t name;
 
-       pres = pjxpidf_create(state_data->pool, pj_cstr(&name, state_data->local));
+       pres = pjxpidf_create(state_data->pool, pj_cstr(&name, ast_strip_quoted(local, "<", ">")));
        return pres;
 }