1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-27 10:03:20 +00:00

- Fix the tmpfile patch to really include the right bounds for

snprintf() and strncat().

PR:		ports/66507
Submitted by:	maintainer
This commit is contained in:
Kirill Ponomarev 2004-05-11 07:35:17 +00:00
parent b52b6ef557
commit 5ab880074e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=108902
2 changed files with 4 additions and 4 deletions

View File

@ -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);
}

View File

@ -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);
}