Page MenuHomeFreeBSD

jail_getid(3): validate jid string input
ClosedPublic

Authored by kevans on May 23 2019, 8:53 PM.
Tags
None
Referenced Files
F132576739: D20388.diff
Sat, Oct 18, 3:00 AM
Unknown Object (File)
Sat, Oct 11, 4:49 AM
Unknown Object (File)
Sat, Oct 11, 4:49 AM
Unknown Object (File)
Sat, Oct 11, 4:49 AM
Unknown Object (File)
Fri, Oct 10, 9:41 PM
Unknown Object (File)
Sun, Oct 5, 2:41 AM
Unknown Object (File)
Sun, Sep 21, 5:23 PM
Unknown Object (File)
Thu, Sep 18, 8:01 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.