Page MenuHomeFreeBSD

jail_getid(3): validate jid string input
ClosedPublic

Authored by kevans on May 23 2019, 8:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 22, 9:45 PM
Unknown Object (File)
Mar 8 2024, 4:00 PM
Unknown Object (File)
Mar 8 2024, 4:00 PM
Unknown Object (File)
Mar 8 2024, 9:27 AM
Unknown Object (File)
Jan 5 2024, 10:12 AM
Unknown Object (File)
Jan 5 2024, 7:28 AM
Unknown Object (File)
Dec 27 2023, 10:06 PM
Unknown Object (File)
Dec 23 2023, 12:42 AM
Subscribers

Details

Summary

Currently, if jail_getid(3) is passed in a numeric string, it assumes that this is a jid string and passes it back converted to an int without checking that it's a valid/existing jid. This breaks consumers that might use jail_getid(3) to see if it can trivially grab a jid from a name if that name happens to be numeric but not actually the name/jid of the jail. Instead of returning -1 for the jail not existing, it'll return the int version of the input and the consumer will not fallback to trying other methods.

Pass the numeric input to jail_get(2) as the jid for validation, rather than the name.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 24450

Event Timeline

Tested with ps and jexec, passing jail name and jid, and with numerically and non-numerically named jails. All's good :-).

This revision is now accepted and ready to land.May 23 2019, 10:46 PM
This revision was automatically updated to reflect the committed changes.