This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In Perl_sv_usepvn_flags, assert() that the caller has RTFM.
authorNicholas Clark <nick@ccl4.org>
Sun, 16 Apr 2006 12:06:57 +0000 (12:06 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 16 Apr 2006 12:06:57 +0000 (12:06 +0000)
p4raw-id: //depot/perl@27842

sv.c

diff --git a/sv.c b/sv.c
index 247ab31..308ecf8 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3920,6 +3920,9 @@ Perl_sv_usepvn_flags(pTHX_ SV *sv, char *ptr, STRLEN len, U32 flags)
     if (SvPVX_const(sv))
        SvPV_free(sv);
 
+    if (flags & SV_HAS_TRAILING_NUL)
+       assert(ptr[len] == '\0');
+
     allocate = (flags & SV_HAS_TRAILING_NUL)
        ? len : PERL_STRLEN_ROUNDUP(len + 1);
 #ifdef DEBUGGING