mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-01 03:57:47 +03:00
Fix assorted memory and static analysis errors
This commit is contained in:
committed by
Felipe Zimmerle
parent
8d0583eda4
commit
e95efa05cc
@@ -37,7 +37,7 @@ extern "C" {
|
||||
|
||||
char *parse_pm_content(const char *op_parm, unsigned short int op_len, const char **error_msg) {
|
||||
char *parm = NULL;
|
||||
char *content = NULL;
|
||||
char *content;
|
||||
unsigned short int offset = 0;
|
||||
// char converted = 0;
|
||||
int i, x;
|
||||
|
@@ -29,7 +29,7 @@ namespace Utils {
|
||||
|
||||
std::string Base64::encode(const std::string& data) {
|
||||
size_t encoded_len = 0;
|
||||
unsigned char *d = NULL;
|
||||
unsigned char *d;
|
||||
std::string ret;
|
||||
|
||||
mbedtls_base64_encode(NULL, 0, &encoded_len,
|
||||
@@ -64,7 +64,7 @@ std::string Base64::decode(const std::string& data, bool forgiven) {
|
||||
|
||||
std::string Base64::decode(const std::string& data) {
|
||||
size_t decoded_len = 0;
|
||||
unsigned char *d = NULL;
|
||||
unsigned char *d;
|
||||
std::string ret;
|
||||
size_t len = strlen(data.c_str());
|
||||
|
||||
@@ -90,7 +90,7 @@ std::string Base64::decode(const std::string& data) {
|
||||
|
||||
std::string Base64::decode_forgiven(const std::string& data) {
|
||||
size_t decoded_len = 0;
|
||||
unsigned char *d = NULL;
|
||||
unsigned char *d;
|
||||
std::string ret;
|
||||
|
||||
decode_forgiven_engine(NULL, 0, &decoded_len,
|
||||
|
@@ -24,7 +24,7 @@
|
||||
extern "C" {
|
||||
|
||||
CPTTree *CPTCreateRadixTree() {
|
||||
CPTTree *tree = NULL;
|
||||
CPTTree *tree;
|
||||
|
||||
tree = reinterpret_cast<CPTTree *>(malloc(sizeof(CPTTree)));
|
||||
|
||||
@@ -60,7 +60,7 @@ void ConvertIPNetmask(unsigned char *buffer, unsigned char netmask, unsigned int
|
||||
}
|
||||
|
||||
TreeNode *CPTCreateNode() {
|
||||
TreeNode *node = NULL;
|
||||
TreeNode *node;
|
||||
|
||||
node = reinterpret_cast<TreeNode *>(malloc(sizeof(TreeNode)));
|
||||
|
||||
@@ -247,7 +247,7 @@ TreeNode *SetParentNode(TreeNode *node, TreeNode *new_node, CPTTree *tree) {
|
||||
int InsertNetmask(TreeNode *node, TreeNode *parent, TreeNode *new_node,
|
||||
CPTTree *tree, unsigned char netmask, unsigned char bitlen) {
|
||||
if (netmask != NETMASK_256-1 && netmask != NETMASK_128) {
|
||||
if ((netmask != NETMASK_32 || (netmask == NETMASK_32 && bitlen != NETMASK_32))) {
|
||||
if (netmask != NETMASK_32 || bitlen != NETMASK_32) {
|
||||
int i;
|
||||
node = new_node;
|
||||
parent = new_node->parent;
|
||||
@@ -383,7 +383,7 @@ TreeNode *CPTAddElement(unsigned char *ipdata, unsigned int ip_bitmask, CPTTree
|
||||
if (test_bit == bitlen && node->bit == bitlen) {
|
||||
if (node->prefix != NULL) {
|
||||
int found = 0;
|
||||
CPTData *prefix_data = NULL;
|
||||
CPTData *prefix_data;
|
||||
|
||||
prefix_data = node->prefix->prefix_data;
|
||||
|
||||
@@ -966,7 +966,7 @@ int add_ip_from_param(
|
||||
{
|
||||
char *param_copy = strdup(param);
|
||||
char *saved = NULL;
|
||||
char *str = NULL;
|
||||
char *str;
|
||||
TreeNode *tnode = NULL;
|
||||
|
||||
str = strtok_r(param_copy, ",", &saved);
|
||||
|
@@ -59,7 +59,7 @@ double cpu_seconds(void) {
|
||||
|
||||
std::string find_resource(const std::string& resource,
|
||||
const std::string& config) {
|
||||
std::ifstream *iss = NULL;
|
||||
std::ifstream *iss;
|
||||
|
||||
// Trying absolute or relative to the current dir.
|
||||
iss = new std::ifstream(resource, std::ios::in);
|
||||
|
Reference in New Issue
Block a user