mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merged revisions 208746 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r208746 | jpeeler | 2009-07-25 01:19:50 -0500 (Sat, 25 Jul 2009) | 7 lines Fix compiling under dev-mode with gcc 4.4.0. Mostly trivial changes, but I did not know of any other way to fix the "dereferencing type-punned pointer will break strict-aliasing rules" error without creating a tmp variable in chan_skinny. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -6329,6 +6329,7 @@ static int get_input(struct skinnysession *s)
|
||||
{
|
||||
int res;
|
||||
int dlen = 0;
|
||||
int *bufaddr;
|
||||
struct pollfd fds[1];
|
||||
|
||||
fds[0].fd = s->fd;
|
||||
@@ -6375,7 +6376,8 @@ static int get_input(struct skinnysession *s)
|
||||
return -1;
|
||||
}
|
||||
|
||||
dlen = letohl(*(int *)s->inbuf);
|
||||
bufaddr = (int *)s->inbuf;
|
||||
dlen = letohl(*bufaddr);
|
||||
if (dlen < 4) {
|
||||
ast_debug(1, "Skinny Client sent invalid data.\n");
|
||||
ast_mutex_unlock(&s->lock);
|
||||
@@ -6384,7 +6386,7 @@ static int get_input(struct skinnysession *s)
|
||||
if (dlen+8 > sizeof(s->inbuf)) {
|
||||
dlen = sizeof(s->inbuf) - 8;
|
||||
}
|
||||
*(int *)s->inbuf = htolel(dlen);
|
||||
*bufaddr = htolel(dlen);
|
||||
|
||||
res = read(s->fd, s->inbuf+4, dlen+4);
|
||||
ast_mutex_unlock(&s->lock);
|
||||
@@ -6403,13 +6405,15 @@ static int get_input(struct skinnysession *s)
|
||||
static struct skinny_req *skinny_req_parse(struct skinnysession *s)
|
||||
{
|
||||
struct skinny_req *req;
|
||||
int *bufaddr;
|
||||
|
||||
if (!(req = ast_calloc(1, SKINNY_MAX_PACKET)))
|
||||
return NULL;
|
||||
|
||||
ast_mutex_lock(&s->lock);
|
||||
memcpy(req, s->inbuf, skinny_header_size);
|
||||
memcpy(&req->data, s->inbuf+skinny_header_size, letohl(*(int*)(s->inbuf))-4);
|
||||
bufaddr = (int *)(s->inbuf);
|
||||
memcpy(&req->data, s->inbuf+skinny_header_size, letohl(*bufaddr)-4);
|
||||
|
||||
ast_mutex_unlock(&s->lock);
|
||||
|
||||
|
Reference in New Issue
Block a user