File tree Expand file tree Collapse file tree
Apache/Ocsinventory/Server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,8 +73,15 @@ sub _set_http_content_type{
7373
7474sub _get_http_header{
7575 my ($header , $r ) = @_ ;
76- return $r -> headers_in-> {$header };
76+ my $value = $r -> headers_in-> {$header };
77+ return unless defined $value ;
78+
79+ $value =~ s / [\x00 -\x08\x0B\x0C\x0E -\x1F ]// g ;
80+ return " Invalid_agent" if $value =~ / [<>"';]/ ;
81+
82+ return $value ;
7783}
84+
7885sub _send_http_headers{
7986 my $r = shift ;
8087 $r -> send_http_header;
Original file line number Diff line number Diff line change @@ -71,7 +71,13 @@ sub _set_http_content_type{
7171
7272sub _get_http_header{
7373 my ($header , $r ) = @_ ;
74- return $r -> headers_in-> {$header };
74+ my $value = $r -> headers_in-> {$header };
75+ return unless defined $value ;
76+
77+ $value =~ s / [\x00 -\x08\x0B\x0C\x0E -\x1F ]// g ;
78+ return " Invalid_agent" if $value =~ / [<>"';]/ ;
79+
80+ return $value ;
7581}
7682
7783sub _send_http_headers{
You can’t perform that action at this time.
0 commit comments