addmntent: Remove unbounded alloca usage from getmntent [BZ#27083]
commit9798906a426fc458b949271bcc9b8ad1608de867
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 22 Dec 2020 11:48:12 +0000 (22 17:18 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 22 Dec 2020 16:02:55 +0000 (22 21:32 +0530)
tree5a1246a4f139cbf9d77ae1d80d3e078ab65df498
parenta2e5da2cf471b5ac849bcd7d9960466b9cd28a35
addmntent: Remove unbounded alloca usage from getmntent [BZ#27083]

The addmntent function replicates elements of struct mnt on stack
using alloca, which is unsafe.  Put characters directly into the
stream, escaping them as they're being written out.

Also add a test to check all escaped characters with addmntent and
getmntent.
misc/Makefile
misc/mntent_r.c
misc/tst-mntent-escape.c [new file with mode: 0644]