Ciao Marco,
dunque la subroutine e' la seguente:
codice:
# This function will convert <, >, & and " to their HTML equivalents. #
sub clean_html {
local $value = $_[0];
$value =~ s/\&/\&/g;
$value =~ s/</\</g;
$value =~ s/>/\>/g;
$value =~ s/"/\"/g;
return $value;
}
per quanto riguarda il punto in cui clean_html viene chiamato ce ne sono diversi, di cui credo che l'ultimo e' quello che mi riguarda.
qui...
codice:
# Now that we have finished using form values for any e-mail related #
# reasons, we will convert all of the form fields and config values #
# to remove any cross-site scripting security holes. #
local($field);
foreach $field (keys %Config) {
$safeConfig{$field} = &clean_html($Config{$field});
}
foreach $field (keys %Form) {
$Form{$field} = &clean_html($Form{$field});
}
qui...
codice:
# For each sorted field, if it has a value or the print blank #
# fields option is turned on print the form field and value. #
foreach $sorted_field (@sorted_fields) {
local $sfname = &clean_html($sorted_field);
qui...
codice:
# For each form field, if it has a value or the print blank #
# fields option is turned on print the form field and value. #
foreach $field (@Field_Order) {
local $fname = &clean_html($field);
qui...
codice:
if ($error eq 'bad_referer') {
if ($ENV{'HTTP_REFERER'} =~ m|^https?://([\w\.]+)|i) {
$host = $1;
my $referer = &clean_html($ENV{'HTTP_REFERER'});
print <<"(END ERROR HTML)";
infine qui...
codice:
elsif ($error eq 'missing_fields') {
if ($Config{'missing_fields_redirect'}) {
print "Location: " . &clean_html($Config{'missing_fields_redirect'}) . "\n\n";
}
else {
foreach $missing_field (@error_fields) {
$missing_field_list .= "[*]" . &clean_html($missing_field) . "\n";
}
print <<"(END ERROR HTML)";
La versione di FormMail e' la 1.92 e io non ho mai modificato lo script. Tuttavia sta nella cgi-bin da una vita e serve appunto anche altri siti. Non so dove la presi all'epoca ed e' possibile che qualche collega/amico/server admin l'abbia toccato...chi sa...
Se vuoi dare un occhiata all'intero script posso postare un link.
Grazie