From 5ab880074ec2f3864bf034a296882111cd9ce227 Mon Sep 17 00:00:00 2001 From: Kirill Ponomarev Date: Tue, 11 May 2004 07:35:17 +0000 Subject: [PATCH] - Fix the tmpfile patch to really include the right bounds for snprintf() and strncat(). PR: ports/66507 Submitted by: maintainer --- mail/mutt/files/patch-mktemp | 4 ++-- mail/mutt14/files/patch-mktemp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mail/mutt/files/patch-mktemp b/mail/mutt/files/patch-mktemp index e8c26f8fc061..8fc82de528d7 100644 --- a/mail/mutt/files/patch-mktemp +++ b/mail/mutt/files/patch-mktemp @@ -7,9 +7,9 @@ - snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getpid (), Counter++); + char t[7]; + snprintf (t, 7, "-%05d", Counter++); -+ snprintf (s, _POSIX_PATH_MAX-7, "%s/mutt-%s-XXXXXXXX", NONULL(Tempdir), NONULL(Hostname)); ++ snprintf (s, _POSIX_PATH_MAX-6, "%s/mutt-%s-XXXXXXXX", NONULL(Tempdir), NONULL(Hostname)); + mktemp (s); -+ strncat(s, t, _POSIX_PATH_MAX); ++ strncat(s, t, 6); unlink (s); } diff --git a/mail/mutt14/files/patch-mktemp b/mail/mutt14/files/patch-mktemp index e8c26f8fc061..8fc82de528d7 100644 --- a/mail/mutt14/files/patch-mktemp +++ b/mail/mutt14/files/patch-mktemp @@ -7,9 +7,9 @@ - snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getpid (), Counter++); + char t[7]; + snprintf (t, 7, "-%05d", Counter++); -+ snprintf (s, _POSIX_PATH_MAX-7, "%s/mutt-%s-XXXXXXXX", NONULL(Tempdir), NONULL(Hostname)); ++ snprintf (s, _POSIX_PATH_MAX-6, "%s/mutt-%s-XXXXXXXX", NONULL(Tempdir), NONULL(Hostname)); + mktemp (s); -+ strncat(s, t, _POSIX_PATH_MAX); ++ strncat(s, t, 6); unlink (s); }