aboutsummaryrefslogtreecommitdiffstats
path: root/lib/strftime.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strftime.c')
-rw-r--r--lib/strftime.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/strftime.c b/lib/strftime.c
index 0a02b507744..acebc9adfad 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -172,15 +172,16 @@ extern char *tzname[];
172#define add(n, f) \ 172#define add(n, f) \
173 do \ 173 do \
174 { \ 174 { \
175 int _n = (n); \ 175 size_t _n = (n); \
176 int _delta = width - _n; \ 176 size_t _w = (width < 0 ? 0 : width); \
177 int _incr = _n + (_delta > 0 ? _delta : 0); \ 177 size_t _incr = _n < _w ? _w : _n; \
178 if ((size_t) _incr >= maxsize - i) \ 178 if (_incr >= maxsize - i) \
179 return 0; \ 179 return 0; \
180 if (p) \ 180 if (p) \
181 { \ 181 { \
182 if (digits == 0 && _delta > 0) \ 182 if (digits == 0 && _n < _w) \
183 { \ 183 { \
184 size_t _delta = width - _n; \
184 if (pad == L_('0')) \ 185 if (pad == L_('0')) \
185 memset_zero (p, _delta); \ 186 memset_zero (p, _delta); \
186 else \ 187 else \