mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 19:47:47 +03:00
Adds a set of sanity checks to validate API inputs (1 of 2)
This commit is contained in:
@@ -170,7 +170,7 @@ std::string toupper(std::string str) {
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> split(std::string str, char delimiter) {
|
||||
std::vector<std::string> ssplit(std::string str, char delimiter) {
|
||||
std::vector<std::string> internal;
|
||||
std::stringstream ss(str); // Turn the string into a stream.
|
||||
std::string tok;
|
||||
@@ -183,6 +183,17 @@ std::vector<std::string> split(std::string str, char delimiter) {
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> split(std::string str, char delimiter) {
|
||||
std::vector<std::string> internal = ssplit(str, delimiter);
|
||||
|
||||
if (internal.size() == 0) {
|
||||
internal.push_back(str);
|
||||
}
|
||||
|
||||
return internal;
|
||||
}
|
||||
|
||||
|
||||
void chomp(std::string *str) {
|
||||
std::string::size_type pos = str->find_last_not_of("\n\r");
|
||||
if (pos != std::string::npos) {
|
||||
|
@@ -64,6 +64,7 @@ std::string string_to_hex(const std::string& input);
|
||||
std::string toHexIfNeeded(const std::string &str);
|
||||
std::string tolower(std::string str);
|
||||
std::string toupper(std::string str);
|
||||
std::vector<std::string> ssplit(std::string str, char delimiter);
|
||||
std::vector<std::string> split(std::string str, char delimiter);
|
||||
void chomp(std::string *str);
|
||||
void replaceAll(std::string *str, const std::string& from,
|
||||
|
Reference in New Issue
Block a user