mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-23 16:01:42 +00:00
Prevent TMPDIR overflow.
This commit is contained in:
parent
769ec4a81a
commit
099d883225
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64239
@ -38,7 +38,11 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)dbtest.c 8.17 (Berkeley) 9/1/94";
|
static char sccsid[] = "@(#)dbtest.c 8.17 (Berkeley) 9/1/94";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$FreeBSD$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -154,7 +158,7 @@ main(argc, argv)
|
|||||||
p = getenv("TMPDIR");
|
p = getenv("TMPDIR");
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
p = "/var/tmp";
|
p = "/var/tmp";
|
||||||
(void)sprintf(buf, "%s/__dbtest", p);
|
(void)snprintf(buf, sizeof(buf), "%s/__dbtest", p);
|
||||||
fname = buf;
|
fname = buf;
|
||||||
(void)unlink(buf);
|
(void)unlink(buf);
|
||||||
} else if (!sflag)
|
} else if (!sflag)
|
||||||
|
Loading…
Reference in New Issue
Block a user