summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 9bae03dc08..8c26d23571 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2763,9 +2763,13 @@ PP(pp_getpeername)
if (!IoIFP(io))
goto nuts;
- sv = sv_2mortal(newSV(257));
- (void)SvPOK_only(sv);
+#ifdef HAS_SOCKADDR_STORAGE
+ len = sizeof(struct sockaddr_storage);
+#else
len = 256;
+#endif
+ sv = sv_2mortal(newSV(len+1));
+ (void)SvPOK_only(sv);
SvCUR_set(sv, len);
*SvEND(sv) ='\0';
fd = PerlIO_fileno(IoIFP(io));