about summary refs log tree commit diff
path: root/include/semaphore.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2017-01-29 11:14:00 -0500
committerRich Felker <dalias@aerifal.cx>2017-01-29 11:14:00 -0500
commitdbbb3734d8c0176feabd6c46e2e85bbc3b8a60af (patch)
tree07279e1a354fddb8ae821bd0dadfb3fa8d4c83c6 /include/semaphore.h
parent01e6bbece2bdcac243cdb8dff6916f2bb80a19e1 (diff)
downloadmusl-dbbb3734d8c0176feabd6c46e2e85bbc3b8a60af.tar.gz
musl-dbbb3734d8c0176feabd6c46e2e85bbc3b8a60af.tar.xz
musl-dbbb3734d8c0176feabd6c46e2e85bbc3b8a60af.zip
fix use of uninitialized pointer in gettext core
the plural_rule field of allocated msgcat structures was assumed to be
initially-null but was never initialized. for future-proofing, the
nplurals field which was left uninitialized should also be cleared.

likewise, in the binding structure, the active field could be used
uninitialized by a technicality: the a_store which stores the initial
value of 0 may be implemented as a cas operation, which reads the old
value.

rather than fixing these issues individually, just use calloc for both
allocations. this does result in wasteful clearing of name buffers (up
to NAME_MAX+PATH_MAX) before filling them, but since the size if
bounded and the time is dominated by filesystem operations, it really
doesn't matter; simplicity and future-proofing have more value here.

modified from patch submitted by He X.
Diffstat (limited to 'include/semaphore.h')
0 files changed, 0 insertions, 0 deletions