diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-11-26 20:01:21 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-11-26 20:01:21 -0500 |
commit | f63b8c8c455929f0f46cc017b4c675faeef901c4 (patch) | |
tree | a266c636db6c9eddd8b2c67b16ffee4245a640b4 /src/fcntl | |
parent | 2b1f2f146d87fa20099c4d7080a07527dd19b165 (diff) | |
download | musl-f63b8c8c455929f0f46cc017b4c675faeef901c4.tar.gz |
fix off-by-one length failure in strftime/wcsftime and improve error behavior
these functions were spuriously failing in the case where the buffer
size was exactly the number of bytes/characters to be written,
including null termination. since these functions do not have defined
error conditions other than buffer size, a reasonable application may
fail to check the return value when the format string and buffer size
are known to be valid; such an application could then attempt to use a
non-terminated buffer.
in addition to fixing the bug, I have changed the error handling
behavior so that these functions always null-terminate the output
except in the case where the buffer size is zero, and so that they
always write as many characters as possible before failing, rather
than dropping whole fields that do not fit. this actually simplifies
the logic somewhat anyway.
Diffstat (limited to 'src/fcntl')
0 files changed, 0 insertions, 0 deletions