Files
freebsd-src/lib
Faraz Vahedi 13bcc9a882 libc: Fix stack buffer overflow in cgetnext()
`cgetnext()` copies a capability record's name field into a fixed
1024 byte on-stack buffer (`nbuf[BSIZE]`) one character at a time,
but never checks that the write pointer stays within the buffer.
Therefore, a record name that is longer than `BSIZE` (either on a
single line, or accumulated across several `\`-continued lines as
the pointer is not reset amidst continuation) writes past the end
of `nbuf` and smashes the stack.

The name field is read directly from the capability file, so any
consumer of `cgetnext()`/`cgetfirst()` that processes an untrusted
`termcap(5)`- or `printcap(5)`-style database (e.g. `cap_mkdb(1)`,
`lpr(1)`, or any third-party caller) can be exposed and hence made
to corrupt the stack.

Reviewed by:	fuz, dteske
Approved by:	fuz (mentor), dteske (mentor)
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2309
2026-10-29 15:39:45 +03:30
..
2026-09-22 08:23:32 -07:00
2026-01-13 10:19:04 -05:00
2026-09-01 15:28:28 +00:00
2024-10-14 10:26:17 -07:00
2025-01-01 15:11:06 -06:00
2024-10-14 10:26:17 -07:00
2026-01-06 12:56:50 -05:00
2026-10-26 10:35:42 +00:00
2026-09-13 18:09:38 -07:00
2026-09-01 14:49:24 +02:00
2025-10-03 19:46:55 +02:00
2026-03-15 00:41:29 -03:00
2025-11-24 10:47:10 -05:00
2025-08-08 13:27:26 -05:00
2024-10-08 16:13:39 -03:00
2026-10-18 11:24:20 -07:00
2024-10-14 10:26:17 -07:00
2026-10-26 10:35:42 +00:00
2024-11-12 12:11:51 -05:00
2026-10-21 13:24:44 +00:00
2025-09-30 09:14:05 +01:00
2026-01-06 04:26:53 +00:00
2026-03-13 23:49:53 +00:00
2026-04-08 14:22:45 -07:00
2026-10-26 10:32:42 +00:00
2026-01-15 07:28:28 +01:00
2026-09-15 10:22:38 -04:00