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)
Tue, Dec 17, 4:51 PM
Unknown Object (File)
Wed, Dec 11, 1:06 PM
Unknown Object (File)
Nov 17 2024, 7:31 AM
Unknown Object (File)
Nov 17 2024, 1:41 AM
Unknown Object (File)
Nov 16 2024, 9:22 PM
Unknown Object (File)
Nov 12 2024, 7:54 PM
Unknown Object (File)
Nov 11 2024, 2:38 PM
Unknown Object (File)
Nov 11 2024, 1:20 PM
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 Not Applicable
Unit
Tests Not Applicable

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.