summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorTAKAI Kousuke <62541129+t-a-k@users.noreply.github.com>2021-04-29 02:11:44 +0900
committerTony Cook <tony@develop-help.com>2022-07-11 11:12:28 +1000
commit0cb18e027fe86875851f8cbf4bd48eb666ce5390 (patch)
treed2f5105e987c394930ff91d90dbaa98e4a9239cf /pp_sys.c
parent80c22fb4d7b4c52dc6e94cfdc4b7d7cd7109bd5a (diff)
downloadperl-0cb18e027fe86875851f8cbf4bd48eb666ce5390.tar.gz
setsockopt: use SvPOK to determine whether OPTVAL is string or integer
setsockopt (pp_ssockopt) used to treat its last argument (OPTVAL) as a packed string whenever it has string slot set (SvPOKp), but this would be confused if the argument is an integer but had cached stringified value. Now it will treat OPTVAL as a packed string only when it is originally created as a string, using Perl 5.36+'s new (internal) feature where POK flag indicates whether the SV started as a string. Will fix GH #18642.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 11c5b2cb82..bb280d2e7a 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2723,7 +2723,7 @@ PP(pp_ssockopt)
const char *buf;
int aint;
SvGETMAGIC(sv);
- if (SvPOKp(sv)) {
+ if (SvPOK(sv)) { /* sv is originally a string */
STRLEN l;
buf = SvPVbyte_nomg(sv, l);
len = l;