From: "Gerd v. Egidy" <lists@egidy.de>
To: mlmmj@mlmmj.org
Subject: Re: Injection also in contrib/web/php-user/mlmmj.php?
Date: Sun, 10 Jan 2010 14:29:05 +0000 [thread overview]
Message-ID: <201001101529.05102.lists@egidy.de> (raw)
In-Reply-To: <87eilycr4q.fsf@marvin.43-1.org>
[-- Attachment #1: Type: Text/Plain, Size: 834 bytes --]
Hi,
> While looking at this, I saw the regular expression used to try to
> validate e-mail addresses in the PHP script:
>
> "^[a-z0-9\._-]+".chr(64)."+[a-z0-9\._-]+\.+[a-z]{2,4}$"
>
> This does not allow a plus (+) in the local part which is permitted (and
> also used by mlmmj itself). There are also TLDs that have more than
> four characters: .travel, .museum, not to begin with international TLDs
> like .xn--zckzah (which are just in testing for now). The PHP script
> should *not* make (wrong) assumptions about what TLDs exist.
Good catch. Since the use is the same I think it we should use the same regex
for perl and php. And then verify once if it fits all valid mail addrs.
The attached patch uses the same regex for php as I introduced for perl with
1.2.16. Please have a deep look at it.
Kind regards,
Gerd
[-- Attachment #2: mlmmj-1.2.17-RC2-php-regex.patch --]
[-- Type: text/x-patch, Size: 575 bytes --]
diff -r -u mlmmj-1.2.17-RC2.orig/contrib/web/php-user/mlmmj.php mlmmj-1.2.17-RC2/contrib/web/php-user/mlmmj.php
--- mlmmj-1.2.17-RC2.orig/contrib/web/php-user/mlmmj.php 2008-10-30 21:06:16.000000000 +0100
+++ mlmmj-1.2.17-RC2/contrib/web/php-user/mlmmj.php 2010-01-10 15:19:50.000000000 +0100
@@ -37,7 +37,7 @@
function is_email($string="")
{
- if (eregi("^[a-z0-9\._-]+".chr(64)."+[a-z0-9\._-]+\.+[a-z]{2,4}$", $string))
+ if (preg_match("/^[-!#$%&\'*+\.\/0-9=?A-Z^_a-z{|}~]+@[-0-9A-Za-z]+\.[-\.0-9A-Za-z]+$/", $string))
{
return TRUE;
}
prev parent reply other threads:[~2010-01-10 14:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-10 7:28 Injection also in contrib/web/php-user/mlmmj.php? Ansgar Burchardt
2010-01-10 11:50 ` Morten Shearman Kirkegaard
2010-01-10 14:29 ` Gerd v. Egidy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201001101529.05102.lists@egidy.de \
--to=lists@egidy.de \
--cc=mlmmj@mlmmj.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.