]> granicus.if.org Git - php/commitdiff
Eliminate strcat() and strcpy()
authorIlia Alshanetsky <iliaa@php.net>
Thu, 25 Jan 2007 00:26:51 +0000 (00:26 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 25 Jan 2007 00:26:51 +0000 (00:26 +0000)
ext/standard/head.c
ext/standard/mail.c

index 370558f6296612868af4f43ca5b8d55f175d5831..af945ff8e027c850eccc0756050f8a1572beed9f 100644 (file)
@@ -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);
index 093c0faee60cc3a2329835882b5f77ccd19ff987..d493d1d591dde018583bc5ea941dce722189842b 100644 (file)
@@ -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;
        }