Check return value of snprintf in mktemp(1)

This commit is contained in:
sin 2014-01-24 16:17:39 +00:00
parent 5be9c21ce4
commit 30620afb6c
1 changed files with 2 additions and 1 deletions

View File

@ -42,7 +42,8 @@ main(int argc, char *argv[])
if ((p = getenv("TMPDIR")))
tmpdir = p;
snprintf(tmppath, sizeof(tmppath), "%s/%s", tmpdir, template);
if (snprintf(tmppath, sizeof(tmppath), "%s/%s", tmpdir, template) >= sizeof(tmppath))
eprintf(EXIT_FAILURE, "path too long\n");
if (dflag) {
if (!mkdtemp(tmppath)) {
if (!qflag)