__fortify_realpath() should trap if PATH_MAX is not defined

This is currently done only if the pointer is non-NULL.
This commit is contained in:
sin 2015-02-28 15:59:27 +00:00
parent 5ebf0ca70e
commit 4672406edd

View File

@ -19,9 +19,13 @@ __fortify_realpath(const char *path, char *resolved)
size_t bos;
if (resolved) {
#ifndef PATH_MAX
__builtin_trap();
#else
bos = __builtin_object_size(resolved, 0);
if (PATH_MAX > bos)
__builtin_trap();
#endif
}
return realpath(path, resolved);
}