mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
More cleanup and fixes in the testing framework.
This commit is contained in:
parent
78f83198d0
commit
ef18503f05
@ -323,7 +323,7 @@ int main(int argc, const char * const argv[])
|
||||
type = argv[1];
|
||||
name = argv[2];
|
||||
param_len = strlen(argv[3]);
|
||||
param = (unsigned char *)apr_pstrmemdup(g_mp, argv[3], param_len);
|
||||
param = apr_pmemdup(g_mp, argv[3], param_len + 1);
|
||||
unescape_inplace(param, ¶m_len);
|
||||
if (argc >= 5) {
|
||||
returnval = argv[4];
|
||||
@ -365,7 +365,7 @@ int main(int argc, const char * const argv[])
|
||||
result = RESULT_WRONGRET;
|
||||
}
|
||||
else if (param_len != out_len) {
|
||||
fprintf(stderr, "Lenth %" APR_SIZE_T_FMT " (param %" APR_SIZE_T_FMT ")\n", out_len, param_len);
|
||||
fprintf(stderr, "Lenth %" APR_SIZE_T_FMT " (expected %" APR_SIZE_T_FMT ")\n", out_len, param_len);
|
||||
result = RESULT_WRONGSIZE;
|
||||
}
|
||||
else {
|
||||
|
@ -68,16 +68,14 @@ sub runfile {
|
||||
my %t = %{$t || {}};
|
||||
my $id = sprintf("%6d", $n);
|
||||
my $in = $t{input};
|
||||
my $out = escape($t{output}); # Escape so we can send via commandline
|
||||
quit(1, "Failed to interpret output \"$cfg\": $@") if ($@);
|
||||
my $param;
|
||||
my $rc = 0;
|
||||
my $param;
|
||||
|
||||
if ($t{type} eq "tfn") {
|
||||
$param = $t{output};
|
||||
$param = escape($t{output});
|
||||
}
|
||||
elsif ($t{type} eq "op") {
|
||||
$param = $t{param};
|
||||
$param = escape($t{param});
|
||||
}
|
||||
else {
|
||||
quit(1, "Unknown type \"$t{type}\" - should be one of: " . join(",",@TYPES));
|
||||
|
@ -41,14 +41,14 @@
|
||||
|
||||
### Invalid Sequences
|
||||
# \8 and \9 are not octal
|
||||
# \666 is a byte overflow (0x1b6) and should be truncated to a byte as \xff
|
||||
# \666 is a byte overflow (0x1b6) and should be truncated to a byte as 0xb6
|
||||
# \xag and \xga are not hex,
|
||||
# \0123 is \012 + '3'
|
||||
{
|
||||
type => "tfn",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\8\\9\\666\\xag\\xga\\0123",
|
||||
output => "89\xffxagxga\x0a3",
|
||||
output => "89\xb6xagxga\x0a3",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
@ -74,6 +74,28 @@
|
||||
output => "xx0\0",
|
||||
ret => 1,
|
||||
},
|
||||
# Octal at end
|
||||
{
|
||||
type => "tfn",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\0",
|
||||
output => "\x00",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfn",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\01",
|
||||
output => "\x01",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfn",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\012",
|
||||
output => "\x0a",
|
||||
ret => 1,
|
||||
},
|
||||
# A forward slash with nothing after
|
||||
{
|
||||
type => "tfn",
|
||||
|
Loading…
x
Reference in New Issue
Block a user