Commit 6bd9c555eed for php.net
commit 6bd9c555eed1a1e5963a0b5144f83ef3878f9d2d
Author: Gina Peter Banyard <girgias@php.net>
Date: Fri Dec 26 00:58:51 2025 +0100
win32/sendmail.c/SendText(): move string duplication code to a more logical place
diff --git a/win32/sendmail.c b/win32/sendmail.c
index 3a32f3e4f0d..2b72ae328e0 100644
--- a/win32/sendmail.c
+++ b/win32/sendmail.c
@@ -571,15 +571,13 @@ static int SendText(char *RPath, const char *Subject, const char *mailTo, const
which would look like "\r\n\r\n". */
memcpy(stripped_header + (pos1 - ZSTR_VAL(headers) - 4), pos2 + 2, strlen(pos2) - 2);
}
+ } else {
+ /* Simplify the code that we create a copy of stripped_header no matter if
+ we actually strip something or not. So we've a single efree() later. */
+ stripped_header = estrndup(ZSTR_VAL(headers), ZSTR_LEN(headers));
}
}
- /* Simplify the code that we create a copy of stripped_header no matter if
- we actually strip something or not. So we've a single efree() later. */
- if (headers && !stripped_header) {
- stripped_header = estrndup(ZSTR_VAL(headers), ZSTR_LEN(headers));
- }
-
if (!Post("DATA\r\n")) {
if (stripped_header) {
efree(stripped_header);