This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Coverity disliked us passing a negative length to vsnprintf().
authorNicholas Clark <nick@ccl4.org>
Sat, 29 Apr 2006 23:35:52 +0000 (23:35 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 29 Apr 2006 23:35:52 +0000 (23:35 +0000)
p4raw-id: //depot/perl@28020

perlio.c

index 8d8a4ec..24f419f 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -5143,7 +5143,7 @@ PerlIO_vsprintf(char *s, int n, const char *fmt, va_list ap)
 {
     dVAR;
 #ifdef USE_VSNPRINTF
-    const int val = vsnprintf(s, n, fmt, ap);
+    const int val = vsnprintf(s, n > 0 ? n : 0, fmt, ap);
 #else
     const int val = vsprintf(s, fmt, ap);
 #endif /* #ifdef USE_VSNPRINTF */