#include <BESScrub.h>
Static Public Member Functions | |
Security functions | |
static bool | command_line_arg_ok (const string &arg) |
sanitize command line arguments | |
static bool | size_ok (unsigned int sz, unsigned int nelem) |
sanitize the size of an array. Test for integer overflow when dynamically allocating an array. | |
static bool | pathname_ok (const string &path, bool strict) |
Does the string name a potentailly valid pathname? Test the given pathname to verfiy that it is a valid name. We define this as: Contains only printable characters; and Is less then 256 characters. If strict is true, test that the pathname consists of only letters, digits, and underscore, dash and dot characters instead of the more general case where a pathname can be composed of any printable characters. |
bool BESScrub::command_line_arg_ok | ( | const string & | arg | ) | [static] |
sanitize command line arguments
Test the given command line argument to protect against command injections
arg | argument to check |
bool BESScrub::pathname_ok | ( | const string & | path, | |
bool | strict | |||
) | [static] |
Does the string name a potentailly valid pathname? Test the given pathname to verfiy that it is a valid name. We define this as: Contains only printable characters; and Is less then 256 characters. If strict is true, test that the pathname consists of only letters, digits, and underscore, dash and dot characters instead of the more general case where a pathname can be composed of any printable characters.
path | The pathname to test | |
strict | Apply more restrictive tests (true by default) |
bool BESScrub::size_ok | ( | unsigned int | sz, | |
unsigned int | nelem | |||
) | [static] |
sanitize the size of an array. Test for integer overflow when dynamically allocating an array.
nelem | Number of elements. | |
sz | size of each element. |
nelem
elements of sz
size will overflow an array.