summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2006-05-19 01:44:14 +0300
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-05-19 15:17:00 +0000
commit1208b3dd78273b01e1538ddb951ee4e62eb90ebe (patch)
tree38b5fd268f3dd503750957b8f5624f81f9f86289 /util.c
parentcf228a9d2f82a9bc6f66fb739370ed1847034425 (diff)
downloadperl-1208b3dd78273b01e1538ddb951ee4e62eb90ebe.tar.gz
Re: [PATCH] Re: Change 28183 has broken 64-bit builds?
Message-ID: <446CCE8E.8010407@gmail.com> p4raw-id: //depot/perl@28234
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util.c b/util.c
index 4e49d1989d..4abdf73100 100644
--- a/util.c
+++ b/util.c
@@ -5380,7 +5380,8 @@ Perl_my_snprintf(char *buffer, const Size_t len, const char *format, ...)
retval = vsprintf(buffer, format, ap);
#endif
va_end(ap);
- if (retval >= len)
+ /* vsnprintf() shows failure with >= len, vsprintf() with < 0 */
+ if (retval < 0 || (len > 0 && retval >= len))
Perl_croak(aTHX_ "panic: my_snprintf buffer overflow");
return retval;
}
@@ -5416,7 +5417,8 @@ Perl_my_vsnprintf(char *buffer, const Size_t len, const char *format, va_list ap
retval = vsprintf(buffer, format, ap);
# endif
#endif /* #ifdef NEED_VA_COPY */
- if (retval >= len)
+ /* vsnprintf() shows failure with >= len, vsprintf() with < 0 */
+ if (retval < 0 || (len > 0 && retval >= len))
Perl_croak(aTHX_ "panic: my_vsnprintf buffer overflow");
return retval;
}