Ticket #592: URI comparison may crash the application (thanks Pedro Gonçalves for the report)

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2205 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip/src/pjsip/sip_uri.c b/pjsip/src/pjsip/sip_uri.c
index c5bb2c5..3ff158c 100644
--- a/pjsip/src/pjsip/sip_uri.c
+++ b/pjsip/src/pjsip/sip_uri.c
@@ -601,6 +601,10 @@
 {
     int d;
 
+    /* Check that naddr2 is also a name_addr */
+    if (naddr1->vptr != naddr2->vptr)
+	return -1;
+
     /* I'm not sure whether display name is included in the comparison. */
     if (pj_strcmp(&naddr1->display, &naddr2->display) != 0) {
 	return -1;
@@ -684,6 +688,10 @@
 			 const pjsip_other_uri *uri2)
 {
     PJ_UNUSED_ARG(context);
+
+    /* Check that uri2 is also an other_uri */
+    if (uri1->vptr != uri2->vptr)
+	return -1;
     
     /* Scheme must match. */
     if (pj_stricmp(&uri1->scheme, &uri2->scheme) != 0) {