Module: sip-router
Branch: master
Commit: 1af47db737d8ca6fcfc43f4abb3d3768f5a8257c
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1af47db…
Author: Ovidiu Sas <osas(a)voipembedded.com>
Committer: Ovidiu Sas <osas(a)voipembedded.com>
Date: Thu Sep 19 09:01:04 2013 -0400
pdb: fix warning dereferencing type-punned pointer will break strict-aliasing rules
[-Wstrict-aliasing]
---
modules/pdb/pdb.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/pdb/pdb.c b/modules/pdb/pdb.c
index 6c5db8c..a5f99cd 100644
--- a/modules/pdb/pdb.c
+++ b/modules/pdb/pdb.c
@@ -158,7 +158,7 @@ static int pdb_query(struct sip_msg *_msg, struct multiparam_t
*_number, struct
{
struct timeval tstart, tnow;
struct server_item_t *server;
- short int carrierid;
+ short int carrierid, *_id;
char buf[NETBUFSIZE+1+sizeof(carrierid)];
size_t reqlen;
int_str avp_val;
@@ -270,7 +270,8 @@ static int pdb_query(struct sip_msg *_msg, struct multiparam_t
*_number, struct
if (recv(server_list->fds[i].fd, buf, NETBUFSIZE, MSG_DONTWAIT) > 0) { /* do
not block - just in case select/poll was wrong */
buf[NETBUFSIZE] = '\0';
if (strncmp(buf, number.s, number.len) == 0) {
- carrierid=ntohs(*((short int *)&(buf[reqlen]))); /* convert to host byte order
*/
+ _id = (short int *)&(buf[reqlen]);
+ carrierid=ntohs(*_id); /* convert to host byte order */
goto found;
}
}