summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2021-03-24 12:02:54 +1100
committerTony Cook <tony@develop-help.com>2021-06-23 10:17:17 +1000
commit2b96d013abf87d80556312b2048ececa0e2a8363 (patch)
tree4be838a4b7fa59af738a6b1e2ad359c5fed9ae03 /pp_sys.c
parentcf70408829693de7ddea8e7914ce769d0e418521 (diff)
downloadperl-2b96d013abf87d80556312b2048ececa0e2a8363.tar.gz
fix magic and upgraded SV handling for setsockopt()'s OPTVAL
The code here checked SV flags before fetching magic, potentially getting confused if magic fetched changed flags. This also fixes handling for upgraded SVs, but I'm not sure that can be tested sufficiently portably.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 9d5d3909de..8c3e478501 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2707,13 +2707,14 @@ PP(pp_ssockopt)
case OP_SSOCKOPT: {
const char *buf;
int aint;
+ SvGETMAGIC(sv);
if (SvPOKp(sv)) {
STRLEN l;
- buf = SvPV_const(sv, l);
+ buf = SvPVbyte_nomg(sv, l);
len = l;
}
else {
- aint = (int)SvIV(sv);
+ aint = (int)SvIV_nomg(sv);
buf = (const char *) &aint;
len = sizeof(int);
}