php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3791 mail() crashes when 4th parameter (headers) is omitted
Submitted: 2000-03-10 08:58 UTC Modified: 2000-05-21 18:10 UTC
From: wez at ryltech dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.14 OS: Win32
Private report: No CVE-ID: None
 [2000-03-10 08:58 UTC] wez at ryltech dot net
A workaround for users is to set 4th parameter to an empty string.

The problem is that headers is strstr()ed and otherwise used without checking to see if it is NULL.

I have modified the source for sendmail.c so that TSendMail looks like this:

int TSendMail(char *host, int *error, char *headers,
char *Subject, char *mailTo, char *data)
{
	int ret;
	char *RPath = NULL;
	TLS_VARS;

	if (headers == NULL)
		headers = "";

... other code unchanged ...

}

Also, the Ack() function can be cleaned up some more - I have done this but I don't know who to send my revised source to...


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-21 18:10 UTC] jim at cvs dot php dot net
fixed correctly (check that headers isn't NULL before calling strstr).
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Jun 27 15:00:02 2026 UTC