Page MenuHomeFreeBSD

jail_getid(3): validate jid string input
ClosedPublic

Authored by kevans on May 23 2019, 8:53 PM.
Tags
None
Referenced Files
F150658744: D20388.id57799.diff
Fri, Apr 3, 4:05 AM
Unknown Object (File)
Wed, Apr 1, 11:55 AM
Unknown Object (File)
Fri, Mar 27, 6:29 AM
Unknown Object (File)
Thu, Mar 26, 8:01 PM
Unknown Object (File)
Thu, Mar 26, 3:55 AM
Unknown Object (File)
Wed, Mar 25, 12:48 PM
Unknown Object (File)
Tue, Mar 24, 4:42 AM
Unknown Object (File)
Sat, Mar 21, 4:29 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.