diff options
author | Karl Williamson <khw@cpan.org> | 2019-10-01 22:34:25 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2019-12-26 14:02:25 -0700 |
commit | 5574513f9f50a19865b379d731a4ec7ae10fefa6 (patch) | |
tree | 1fc247edcee88a54bba7ea80110fdc02e3f97939 /util.c | |
parent | 0860e09008fc680efc179c7667586a9f5b634077 (diff) | |
download | perl-5574513f9f50a19865b379d731a4ec7ae10fefa6.tar.gz |
util.c: Use inRANGE macro
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3874,7 +3874,7 @@ Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, in ** If there is a better way to make it portable, go ahead by ** all means. */ - if ((len > 0 && len < buflen) || (len == 0 && *fmt == '\0')) + if (inRANGE(len, 1, buflen - 1) || (len == 0 && *fmt == '\0')) return buf; else { /* Possibly buf overflowed - try again with a bigger buf */ @@ -3888,7 +3888,7 @@ Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, in buflen = strftime(buf, bufsize, fmt, &mytm); GCC_DIAG_RESTORE_STMT; - if (buflen > 0 && buflen < bufsize) + if (inRANGE(buflen, 1, bufsize - 1)) break; /* heuristic to prevent out-of-memory errors */ if (bufsize > 100*fmtlen) { |