summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvador Ortiz Garcia <sog@msg.com.mx>2009-09-06 23:41:57 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-09-06 23:41:57 +0200
commitd8723a6a74b2c12e9d732728dbe717672ab893f2 (patch)
tree24f0470722ebc791b8faebc46444e8c649c2894b
parentacb65a20b3f3b0f0cee262142e279624eaae58bb (diff)
downloadperl-d8723a6a74b2c12e9d732728dbe717672ab893f2.tar.gz
Corrupt filename when setting %INC entry in a @INC hook
The code in pp_ctl.c after calling an @INC hook blindly assumes that the SV setted by the user in %INC is an SVPV (SvPOK true) for setting the filename. So when the user uses other scalar types, the output of __FILE__, warn, die, caller, etc. shows random garbage.
-rw-r--r--pp_ctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 0eb513f9a3..4cde9f8854 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3354,7 +3354,7 @@ PP(pp_require)
/* Adjust file name if the hook has set an %INC entry */
svp = hv_fetch(GvHVn(PL_incgv), name, len, 0);
if (svp)
- tryname = SvPVX_const(*svp);
+ tryname = SvPV_nolen_const(*svp);
if (count > 0) {
int i = 0;