Fixed ticket #307: Fail to parse fully qualified PIDF document (thanks Cool_Zer0)
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1313 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip/src/pjsip-simple/pidf.c b/pjsip/src/pjsip-simple/pidf.c
index 730194c..922549d 100644
--- a/pjsip/src/pjsip-simple/pidf.c
+++ b/pjsip/src/pjsip-simple/pidf.c
@@ -343,11 +343,16 @@
PJ_DEF(pjpidf_pres*) pjpidf_parse(pj_pool_t *pool, char *text, int len)
{
pjpidf_pres *pres = pj_xml_parse(pool, text, len);
- if (pres) {
- if (pj_stricmp(&pres->name, &PRESENCE) != 0)
- return NULL;
+ if (pres && pres->name.slen >= 8) {
+ pj_str_t name;
+
+ name.ptr = pres->name.ptr + (pres->name.slen - 8);
+ name.slen = 8;
+
+ if (pj_stricmp(&name, &PRESENCE) == 0)
+ return pres;
}
- return pres;
+ return NULL;
}
PJ_DEF(int) pjpidf_print(const pjpidf_pres* pres, char *buf, int len)