SOURCES: php-mail.patch - merge newline injection in extra_headers...

glen glen at pld-linux.org
Wed Jun 7 16:51:09 CEST 2006


Author: glen                         Date: Wed Jun  7 14:51:09 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- merge newline injection in extra_headers patch from http://files.zoeloelip.be/mail-headers.diff

---- Files affected:
SOURCES:
   php-mail.patch (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: SOURCES/php-mail.patch
diff -u SOURCES/php-mail.patch:1.10 SOURCES/php-mail.patch:1.11
--- SOURCES/php-mail.patch:1.10	Sat Mar 27 00:58:25 2004
+++ SOURCES/php-mail.patch	Wed Jun  7 16:51:04 2006
@@ -1,5 +1,5 @@
---- php-4.3.0/ext/standard/mail.c.orig	Fri Nov 29 12:15:43 2002
-+++ php-4.3.0/ext/standard/mail.c	Thu Jan  2 12:37:54 2003
+--- php-4.3.0/ext/standard/mail.c	Thu Jan  2 12:37:54 2003
++++ php-5.1.4-mail/ext/standard/mail.c	2006-06-07 17:48:45.197705968 +0300
 @@ -21,6 +21,8 @@
  #include <stdlib.h>
  #include <ctype.h>
@@ -19,7 +19,43 @@
  #if HAVE_SENDMAIL
  #ifdef PHP_WIN32
  #include "win32/sendmail.h"
-@@ -196,8 +201,42 @@
+@@ -104,6 +109,35 @@
+ 		return;
+ 	}
+ 
++    /* check for spam attempts with buggy webforms */
++    if (strchr(to, '\n') != NULL || strchr(to, '\r') != NULL) {
++        zend_error(E_WARNING, "Newlines aren't allowed in the To header.");
++        RETURN_FALSE;
++    }
++
++    if (strchr(subject, '\n') != NULL || strchr(subject, '\r') != NULL) {
++        zend_error(E_WARNING, "Newlines aren't allowed in the Subject header.");
++        RETURN_FALSE;
++    }
++
++    /* search for to, cc or bcc headers */
++    if (headers != NULL) {
++        if (strncasecmp(headers, "to:", sizeof("to:") - 1) == 0 || strcasestr(headers, "\nto:")) {
++            zend_error(E_WARNING, "To: headers aren't allowed in the headers parameter.");
++            RETURN_FALSE;
++        }
++
++        if (strncasecmp(headers, "cc:", sizeof("cc:") - 1) == 0 || strcasestr(headers, "\ncc:")) {
++            zend_error(E_WARNING, "CC: headers aren't allowed in the headers parameter.");
++            RETURN_FALSE;
++        }
++
++        if (strncasecmp(headers, "bcc:", sizeof("bcc:") - 1) == 0 || strcasestr(headers, "\nbcc:")) {
++            zend_error(E_WARNING, "BCC: headers aren't allowed in the headers parameter.");
++            RETURN_FALSE;
++        }
++    }
++
+ 	if (to_len > 0) {
+ 		to_r = estrndup(to, to_len);
+ 		for (; to_len; to_len--) {
+@@ -196,8 +230,42 @@
  			return 0;
  		}
  #endif
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/php-mail.patch?r1=1.10&r2=1.11&f=u



More information about the pld-cvs-commit mailing list