From 094a5717b1b0b465ec847d8606261398a782c478 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 25 Jan 2007 00:26:51 +0000 Subject: [PATCH] Eliminate strcat() and strcpy() --- ext/standard/head.c | 2 +- ext/standard/mail.c | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ext/standard/head.c b/ext/standard/head.c index 370558f629..af945ff8e0 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -109,7 +109,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t } else { sprintf(cookie, "Set-Cookie: %s=%s", name, value ? encoded_value : ""); if (expires > 0) { - strcat(cookie, "; expires="); + strlcat(cookie, "; expires=", len + 100); dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, expires, 0 TSRMLS_CC); strlcat(cookie, dt, len + 100); efree(dt); diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 093c0faee6..d493d1d591 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -200,10 +200,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char #endif } if (extra_cmd != NULL) { - sendmail_cmd = emalloc (strlen (sendmail_path) + strlen (extra_cmd) + 2); - strcpy (sendmail_cmd, sendmail_path); - strcat (sendmail_cmd, " "); - strcat (sendmail_cmd, extra_cmd); + spprintf(&sendmail_cmd, 0, "%s %s", sendmail_path, extra_cmd); } else { sendmail_cmd = sendmail_path; } -- 2.40.0