diff options
author | Tony Cook <tony@develop-help.com> | 2021-03-24 12:02:54 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2021-06-23 10:17:17 +1000 |
commit | 2b96d013abf87d80556312b2048ececa0e2a8363 (patch) | |
tree | 4be838a4b7fa59af738a6b1e2ad359c5fed9ae03 /pp_sys.c | |
parent | cf70408829693de7ddea8e7914ce769d0e418521 (diff) | |
download | perl-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); } |