Check that snprintf() does not truncate the destination pathname when
linking into a directory.
This commit is contained in:
parent
83975c1387
commit
c2f443c824
@ -189,7 +189,12 @@ linkit(const char *target, const char *source, int isdir)
|
||||
p = target;
|
||||
else
|
||||
++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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user