mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
(canonicalize_file_name): Return NULL immediately if resolvepath fails.
Otherwise, `readlink --canonical /no-such-file' would exhaust virtual memory on some systems (e.g. Solaris).
This commit is contained in:
1 parent
6a5f07163f
commit
ef6c004648
1 file changed
+5
@@ -147,6 +147,11 @@ canonicalize_file_name (const char *name)
|
||||
resolved_size = 2 * resolved_size + 1;
|
||||
resolved = xmalloc (resolved_size);
|
||||
resolved_len = resolvepath (name, resolved, resolved_size);
|
||||
if (resolved_len < 0)
|
||||
{
|
||||
free (resolved);
|
||||
return NULL;
|
||||
}
|
||||
if (resolved_len < resolved_size)
|
||||
break;
|
||||
free (resolved);
|
||||
|
||||
Reference in new issue
Block a user