mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-11 09:50:12 +00:00
Check that snprintf() does not truncate the destination pathname when
linking into a directory.
This commit is contained in:
parent
2d39517f33
commit
a24ce1c859
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99019
@ -189,7 +189,12 @@ linkit(const char *target, const char *source, int isdir)
|
|||||||
p = target;
|
p = target;
|
||||||
else
|
else
|
||||||
++p;
|
++p;
|
||||||
(void)snprintf(path, sizeof(path), "%s/%s", source, p);
|
if (snprintf(path, sizeof(path), "%s/%s", source, p) >=
|
||||||
|
sizeof(path)) {
|
||||||
|
errno = ENAMETOOLONG;
|
||||||
|
warn("%s", target);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
source = path;
|
source = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user