[sr-dev] git:andrei/pointer_alias_warnings: rr(s): fix recently introduced avp_cookie name bug

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Jan 28 19:59:23 CET 2010


Module: sip-router
Branch: andrei/pointer_alias_warnings
Commit: 1c588c85a086aff42da5aa2a7da5ad663c896de1
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1c588c85a086aff42da5aa2a7da5ad663c896de1

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu Jan 28 19:58:06 2010 +0100

rr(s): fix recently introduced avp_cookie name bug

- fix bug introduced in 34dc702 (while trying to fix pointer
  aliasing warnings)

---

 modules_s/rr/avp_cookie.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules_s/rr/avp_cookie.c b/modules_s/rr/avp_cookie.c
index 1e9d027..c7e1fb4 100644
--- a/modules_s/rr/avp_cookie.c
+++ b/modules_s/rr/avp_cookie.c
@@ -56,6 +56,9 @@ str *rr_get_avp_cookies(void) {
 	str *avp_name;
 	str *result = 0;
 	rr_avp_flags_t avp_flags;
+	struct str_int_data *sid;
+	struct str_str_data *ssd;
+
 
 	len = sizeof(crc);
 	for (avp_list_no=0; avp_list_no<MAX_AVP_DIALOG_LISTS; avp_list_no++) {
@@ -66,11 +69,13 @@ str *rr_get_avp_cookies(void) {
 
 			if ((avp->flags&(AVP_NAME_STR|AVP_VAL_STR)) == AVP_NAME_STR) {
 				/* avp type str, int value */
-				avp_name = &  ((struct str_int_data*)avp->d.p)->name;
+				sid = (struct str_int_data*)&avp->d.data[0];
+				avp_name = &sid->name;
 			}
 			else if ((avp->flags&(AVP_NAME_STR|AVP_VAL_STR)) == (AVP_NAME_STR|AVP_VAL_STR)) {
 				/* avp type str, str value */
-				avp_name = & ((struct str_str_data*)avp->d.p)->name;
+				ssd = (struct str_str_data*)&avp->d.data[0];
+				avp_name = &ssd->name;
 			}
 			else
 				avp_name = 0;  /* dummy */




More information about the sr-dev mailing list