Bug 221854 - makefs: Reject UFS labels that are too long to fit
Summary: makefs: Reject UFS labels that are too long to fit
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-08-27 10:49 UTC by Fabian Keil
Modified: 2023-04-18 17:45 UTC (History)
2 users (show)

See Also:
fk: mfc-stable11?


Attachments
makefs: Reject UFS labels that are too long to fit (1006 bytes, patch)
2017-08-27 10:49 UTC, Fabian Keil
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Keil 2017-08-27 10:49:53 UTC
Created attachment 185810 [details]
makefs: Reject UFS labels that are too long to fit

If a specified UFS label is too long to fit, makefs currently silently truncates it.

This causes problems if the created file system contains files like
/etc/fstab that expect the whole label.

You may end up with a release image that was built "successfully"
but doesn't actually boot.

The attached patch lets makefs reject UFS labels that don't fit which
makes the issue easier to spot.

Obtained from: ElectroBSD
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:51:40 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 2 Piotr Pawel Stefaniak freebsd_committer freebsd_triage 2021-09-30 21:02:51 UTC
In 2017, Ed imported option parsing from NetBSD so this patch no longer applies. While I support the improvement, it has the side effect that since all strings are handled like this:
		case OPT_STRARRAY:
			strlcpy((void *)options[i].value, val, (size_t)
			    options[i].maximum);
			break;
you can't be selective about which truncation is tolerable and which is not.

Ed, maybe we should reject any and all truncation errors in this path?