commit | 48b16e2725249985c9f1841928eb08574c24d3cc | [log] [tgz] |
---|---|---|
author | Jens Axboe <axboe@fb.com> | Mon Apr 14 08:23:23 2014 -0600 |
committer | Jens Axboe <axboe@fb.com> | Mon Apr 14 08:23:23 2014 -0600 |
tree | 163177618e264b7f420443a417b79c82ebcc94b2 | |
parent | 4a4ac4e342418dde6457eddae7ff3ef136bbbe6a [diff] [blame] |
stat: check that TEMP environment variable is half-way sane Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/stat.c b/stat.c index 509c6f0..5a553d0 100644 --- a/stat.c +++ b/stat.c
@@ -1494,8 +1494,11 @@ return 0; temp_dir = getenv("TMPDIR"); - if (temp_dir == NULL) + if (temp_dir == NULL) { temp_dir = getenv("TEMP"); + if (temp_dir && strlen(temp_dir) >= PATH_MAX) + temp_dir = NULL; + } if (temp_dir == NULL) temp_dir = "/tmp";