mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Fix assorted memory and static analysis errors
This commit is contained in:
committed by
Felipe Zimmerle
parent
8d0583eda4
commit
e95efa05cc
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "modsecurity/transaction.h"
|
||||
#include "modsecurity/rule.h"
|
||||
|
@@ -35,7 +35,7 @@ namespace transformations {
|
||||
std::string HexDecode::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
int size = 0;
|
||||
|
||||
input = reinterpret_cast<unsigned char *>
|
||||
|
@@ -36,7 +36,7 @@ namespace transformations {
|
||||
std::string HtmlEntityDecode::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
|
||||
input = reinterpret_cast<unsigned char *>
|
||||
(malloc(sizeof(char) * value.length()+1));
|
||||
@@ -98,7 +98,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
||||
}
|
||||
if (j > k) { /* Do we have at least one digit? */
|
||||
/* Decode the entity. */
|
||||
char *x = NULL;
|
||||
char *x;
|
||||
x = reinterpret_cast<char *>(calloc(sizeof(char),
|
||||
((j - k) + 1)));
|
||||
memcpy(x, (const char *)&input[k], j - k);
|
||||
@@ -124,7 +124,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
||||
}
|
||||
if (j > k) { /* Do we have at least one digit? */
|
||||
/* Decode the entity. */
|
||||
char *x = NULL;
|
||||
char *x;
|
||||
x = reinterpret_cast<char *>(calloc(sizeof(char),
|
||||
((j - k) + 1)));
|
||||
memcpy(x, (const char *)&input[k], j - k);
|
||||
@@ -150,7 +150,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
||||
j++;
|
||||
}
|
||||
if (j > k) { /* Do we have at least one digit? */
|
||||
char *x = NULL;
|
||||
char *x;
|
||||
x = reinterpret_cast<char *>(calloc(sizeof(char),
|
||||
((j - k) + 1)));
|
||||
memcpy(x, (const char *)&input[k], j - k);
|
||||
|
@@ -37,7 +37,7 @@ namespace transformations {
|
||||
std::string JsDecode::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
|
||||
input = reinterpret_cast<unsigned char *>
|
||||
(malloc(sizeof(char) * value.length()+1));
|
||||
|
@@ -35,7 +35,7 @@ namespace transformations {
|
||||
std::string ParityEven7bit::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
|
||||
input = reinterpret_cast<unsigned char *>
|
||||
(malloc(sizeof(char) * value.length()+1));
|
||||
|
@@ -35,7 +35,7 @@ namespace transformations {
|
||||
std::string ParityOdd7bit::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
|
||||
input = reinterpret_cast<unsigned char *>
|
||||
(malloc(sizeof(char) * value.length()+1));
|
||||
|
@@ -35,7 +35,7 @@ namespace transformations {
|
||||
std::string ParityZero7bit::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
|
||||
input = reinterpret_cast<unsigned char *>
|
||||
(malloc(sizeof(char) * value.length()+1));
|
||||
|
@@ -35,7 +35,7 @@ namespace transformations {
|
||||
std::string RemoveComments::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
|
||||
input = reinterpret_cast<unsigned char *>
|
||||
(malloc(sizeof(char) * value.length()+1));
|
||||
|
@@ -44,7 +44,7 @@ namespace transformations {
|
||||
std::string SqlHexDecode::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
int size = 0;
|
||||
|
||||
input = reinterpret_cast<unsigned char *>
|
||||
|
@@ -38,7 +38,7 @@ namespace transformations {
|
||||
std::string UrlDecodeUni::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
|
||||
input = reinterpret_cast<unsigned char *>
|
||||
(malloc(sizeof(char) * value.length()+1));
|
||||
|
@@ -36,7 +36,7 @@ namespace transformations {
|
||||
std::string Utf8ToUnicode::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *input;
|
||||
int changed = 0;
|
||||
char *out;
|
||||
|
||||
|
Reference in New Issue
Block a user