Bugzilla bug #33652: align PRNetAddr on 8-byte boundaries.

Modified files: prsocket.c, ptio.c
This commit is contained in:
wtc%netscape.com 2000-03-29 02:24:39 +00:00
Родитель d58cbd4e51
Коммит 574eaf987b
2 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -1645,8 +1645,9 @@ PRInt32 _PR_EmulateAcceptRead(
if (rv >= 0)
{
/* copy the new info out where caller can see it */
PRPtrdiff aligned = (PRPtrdiff)buf + amount + sizeof(void*) - 1;
*raddr = (PRNetAddr*)(aligned & ~(sizeof(void*) - 1));
enum { AMASK = 7 }; /* mask for alignment of PRNetAddr */
PRPtrdiff aligned = (PRPtrdiff)buf + amount + AMASK;
*raddr = (PRNetAddr*)(aligned & ~AMASK);
memcpy(*raddr, &remote, PR_NETADDR_SIZE(&remote));
*nd = accepted;
return rv;

Просмотреть файл

@ -2103,8 +2103,9 @@ static PRInt32 pt_AcceptRead(
if (rv >= 0)
{
/* copy the new info out where caller can see it */
PRPtrdiff aligned = (PRPtrdiff)buf + amount + sizeof(void*) - 1;
*raddr = (PRNetAddr*)(aligned & ~(sizeof(void*) - 1));
enum { AMASK = 7 }; /* mask for alignment of PRNetAddr */
PRPtrdiff aligned = (PRPtrdiff)buf + amount + AMASK;
*raddr = (PRNetAddr*)(aligned & ~AMASK);
memcpy(*raddr, &remote, PR_NETADDR_SIZE(&remote));
*nd = accepted;
return rv;