This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix security problem: CWE-134: Use of Externally-Controlled Format String
authorPali <pali@cpan.org>
Sun, 3 Dec 2017 16:02:53 +0000 (17:02 +0100)
committerTony Cook <tony@develop-help.com>
Mon, 15 Jan 2018 23:26:59 +0000 (10:26 +1100)
Function croak() takes printf-like formatted string, so passing arbitrary
char* can leads to buffer overflow. Use croak_sv() which is now available
and avoids converting SV* to char*.

dist/Devel-PPPort/parts/inc/call
dist/Devel-PPPort/parts/inc/ppphtest

index 7d8e4d3..7c46cbb 100644 (file)
@@ -69,8 +69,8 @@ eval_pv(char *p, I32 croak_on_error)
     sv = POPs;
     PUTBACK;
 
-    if (croak_on_error && SvTRUE(GvSV(errgv)))
-        croak(SvPVx(GvSV(errgv), na));
+    if (croak_on_error && SvTRUEx(ERRSV))
+        croak_sv(ERRSV);
 
     return sv;
 }
index cef6c40..925929d 100644 (file)
@@ -523,6 +523,7 @@ call_pv();
 #define NEED_eval_pv_GLOBAL
 #define NEED_grok_hex
 #define NEED_newCONSTSUB_GLOBAL
+#define NEED_sv_2pv_flags_GLOBAL
 #include "ppport.h"
 
 newCONSTSUB();