diff options
| author | Tyge Løvset <[email protected]> | 2020-10-24 14:26:07 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-10-24 14:26:07 +0200 |
| commit | aee8714e172c247a81a9f7069602b96aa389d719 (patch) | |
| tree | 455f8e5398a4a3a795f0170508f263a32bc1843d | |
| parent | 071d3d1e2e6d2e1ed8a4bf92db86ef407cc454c0 (diff) | |
| download | STC-modified-aee8714e172c247a81a9f7069602b96aa389d719.tar.gz STC-modified-aee8714e172c247a81a9f7069602b96aa389d719.zip | |
Make sure returned buf is null terminated on unseuccessful strftime.
| -rw-r--r-- | stc/cfmt.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -33,7 +33,7 @@ STC_API char* _cfmt_conv(int nargs, const char *fmt, ...); enum {_cfmt_bn=4, _cfmt_sn=64};
STC_INLINE const char* _cfmt_strftime(char* n, char buf[][_cfmt_sn], size_t maxsize, const char *fmt, const struct tm *timeptr) {
if (*n >= _cfmt_bn) return fmt;
- int k = (*n)++;
+ int k = (*n)++; buf[k][0] = '\0';
strftime(buf[k], maxsize, fmt, timeptr);
return buf[k];
}
|
