summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2013-09-03 10:17:35 +1000
committerTony Cook <tony@develop-help.com>2013-09-09 15:22:18 +1000
commit41188aa0f6683329a6ebb1811827fce0a096df6e (patch)
tree2a32b38c849f9ad1074e92699426237a5ebc2ed4 /perlio.c
parent788436d2421782aa270928cb9fa6214f251f6797 (diff)
downloadperl-41188aa0f6683329a6ebb1811827fce0a096df6e.tar.gz
[perl #117265] correctly handle overloaded strings
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/perlio.c b/perlio.c
index 7de7085d6b..c2cc3197ce 100644
--- a/perlio.c
+++ b/perlio.c
@@ -312,8 +312,9 @@ PerlIO_openn(pTHX_ const char *layers, const char *mode, int fd,
if (*args == &PL_sv_undef)
return PerlIO_tmpfile();
else {
- const char *name = SvPV_nolen_const(*args);
- if (!IS_SAFE_PATHNAME(*args, "open"))
+ STRLEN len;
+ const char *name = SvPV_nolen_const(*args, len);
+ if (!IS_SAFE_PATHNAME(name, len, "open"))
return NULL;
if (*mode == IoTYPE_NUMERIC) {
@@ -2725,8 +2726,9 @@ PerlIOUnix_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
#endif
}
if (imode != -1) {
- const char *path = SvPV_nolen_const(*args);
- if (!IS_SAFE_PATHNAME(*args, "open"))
+ STRLEN len;
+ const char *path = SvPV_const(*args, len);
+ if (!IS_SAFE_PATHNAME(path, len, "open"))
return NULL;
fd = PerlLIO_open3(path, imode, perm);
}
@@ -3039,10 +3041,11 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
{
char tmode[8];
if (PerlIOValid(f)) {
- const char * const path = SvPV_nolen_const(*args);
+ STRLEN len;
+ const char * const path = SvPV_const(*args, len);
PerlIOStdio * const s = PerlIOSelf(f, PerlIOStdio);
FILE *stdio;
- if (!IS_SAFE_PATHNAME(*args, "open"))
+ if (!IS_SAFE_PATHNAME(path, len, "open"))
return NULL;
PerlIOUnix_refcnt_dec(fileno(s->stdio));
stdio = PerlSIO_freopen(path, (mode = PerlIOStdio_mode(mode, tmode)),
@@ -3055,8 +3058,9 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
}
else {
if (narg > 0) {
- const char * const path = SvPV_nolen_const(*args);
- if (!IS_SAFE_PATHNAME(*args, "open"))
+ STRLEN len;
+ const char * const path = SvPV_const(*args, len);
+ if (!IS_SAFE_PATHNAME(path, len, "open"))
return NULL;
if (*mode == IoTYPE_NUMERIC) {
mode++;