diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2006-05-19 01:44:14 +0300 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-05-19 15:17:00 +0000 |
commit | 1208b3dd78273b01e1538ddb951ee4e62eb90ebe (patch) | |
tree | 38b5fd268f3dd503750957b8f5624f81f9f86289 /util.c | |
parent | cf228a9d2f82a9bc6f66fb739370ed1847034425 (diff) | |
download | perl-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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; } |