summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-06-22 15:55:13 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-06-22 15:55:13 +0000
commit93d47a36f80f3fc6495f8b7e57fd85c0089c60d3 (patch)
treee6bb7a9f877acb8091a1c4c1bd2f95ace4cc2a5b /pp_sys.c
parent485aafd95a0455dba277922a8e8f7c0a7adc192c (diff)
downloadperl-93d47a36f80f3fc6495f8b7e57fd85c0089c60d3.tar.gz
Debian fix from Brendan O'Dea:
Bug#156284: the stucture used by pp_accept is too small to hold an IPv6 address. p4raw-id: //depot/perl@19836
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 77a547edbd..7ee8b9e049 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2479,8 +2479,12 @@ PP(pp_accept)
GV *ggv;
register IO *nstio;
register IO *gstio;
- struct sockaddr saddr; /* use a struct to avoid alignment problems */
- Sock_size_t len = sizeof saddr;
+ char namebuf[MAXPATHLEN];
+#if (defined(VMS_DO_SOCKETS) && defined(DECCRTL_SOCKETS)) || defined(MPE) || defined(__QNXNTO__)
+ Sock_size_t len = sizeof (struct sockaddr_in);
+#else
+ Sock_size_t len = sizeof namebuf;
+#endif
int fd;
ggv = (GV*)POPs;
@@ -2496,7 +2500,7 @@ PP(pp_accept)
goto nuts;
nstio = GvIOn(ngv);
- fd = PerlSock_accept(PerlIO_fileno(IoIFP(gstio)), (struct sockaddr *)&saddr, &len);
+ fd = PerlSock_accept(PerlIO_fileno(IoIFP(gstio)), (struct sockaddr *) namebuf, &len);
if (fd < 0)
goto badexit;
if (IoIFP(nstio))
@@ -2515,14 +2519,14 @@ PP(pp_accept)
#endif
#ifdef EPOC
- len = sizeof saddr; /* EPOC somehow truncates info */
+ len = sizeof (struct sockaddr_in); /* EPOC somehow truncates info */
setbuf( IoIFP(nstio), NULL); /* EPOC gets confused about sockets */
#endif
#ifdef __SCO_VERSION__
- len = sizeof saddr; /* OpenUNIX 8 somehow truncates info */
+ len = sizeof (struct sockaddr_in); /* OpenUNIX 8 somehow truncates info */
#endif
- PUSHp((char *)&saddr, len);
+ PUSHp(namebuf, len);
RETURN;
nuts: