summary refs log tree commit diff
path: root/support/check.c
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2021-12-05 11:51:17 +0100
committerAurelien Jarno <aurelien@aurel32.net>2021-12-07 23:32:53 +0100
commitcbab7f726877badc5059316e7248be7c3bff9d96 (patch)
tree4b02fa3bf598e493ec0a0a6b0f08f8c16bab2fc7 /support/check.c
parentceeffe968c01b1202e482f4855cb6baf5c6cb713 (diff)
downloadglibc-cbab7f726877badc5059316e7248be7c3bff9d96.tar.gz
glibc-cbab7f726877badc5059316e7248be7c3bff9d96.tar.xz
glibc-cbab7f726877badc5059316e7248be7c3bff9d96.zip
localedef: check magic value on archive load [BZ #28650]
localedef currently blindly trust the archive header. When passed an
archive file with the wrong endianess, this leads to a segmentation
fault:

  $ localedef --big-endian --list-archive /usr/lib/locale/locale-archive
  Segmentation fault (core dumped)

When passed non-archive files, asserts are reported on the best case,
but sometimes it can lead to a segmentation fault:

  $ localedef --list-archive /bin/true
  localedef: programs/locarchive.c:1643: show_archive_content: Assertion `used < GET (head->namehash_used)' failed.
  Aborted (core dumped)

  $ localedef --list-archive /usr/lib/locale/C.utf8/LC_COLLATE
  Segmentation fault (core dumped)

This patch improves the user experience by looking at the magic value,
which is always written, but never checked. It should still be possible
to trigger a segmentation fault with crafted files, but this already
catch many cases.
Diffstat (limited to 'support/check.c')
0 files changed, 0 insertions, 0 deletions