BUG: Patch to fix email address scanner broken in 2.0b2

From: David D. Kilzer <ddkilzer_at_madison.dseg.ti.com_at_hypermail-project.org>
Date: Fri, 14 Aug 1998 13:22:05 -0500
Message-Id: <199808141822.NAA08100_at_elbonia.dseg.ti.com>


Let me guess, has this one been fixed in 2.0b3, too? :^)

The patch below fixes the obivous problem: changing "0-0" to "0-9" in VALID_IN_EMAIL_ADD. It also does two more things:

  1. Allows email addresses with percent signs (%) in the left-hand side of the address.
  2. Does NOT allow underscores (_) in domainnames on the right-hand side of the address. (See RFC 1035; only dashes (-) are allowed aside from letters, numbers and periods.)

Ideally, a small parser (a la lex & yacc) could be used for both email addresses and URLs to ensure proper identification.

Dave

-#define VALID_IN_EMAIL_ADD "a-zA-Z0-0_.-"
+#define VALID_IN_EMAIL_USERNAME   "a-zA-Z0-9_.%-"
+#define VALID_IN_EMAIL_DOMAINNAME "a-zA-Z0-9.-"
 
           /* check left side */
           while (backoff) {
-              if (sscanf(email, "%1[" VALID_IN_EMAIL_ADD "]", content)) {
+              if (sscanf(email, "%1[" VALID_IN_EMAIL_USERNAME "]", content)) {
                   email--;
                   backoff--;
               }

_at_@ -587,7 +588,9 @@
} if (email != ptr-1) { /* bigger chance this is an address */ email++; - if (sscanf(ptr+1, "%255[" VALID_IN_EMAIL_ADD "]", mailbuff)) { + if (sscanf(ptr+1, "%255[" VALID_IN_EMAIL_DOMAINNAME "]", + mailbuff)) + { /* a valid mail right-end */ if (lastpos < email) {
Received on Fri 14 Aug 1998 08:37:39 PM GMT

This archive was generated by hypermail 2.3.0 : Sat 13 Mar 2010 03:46:11 AM GMT GMT