X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=file_subs.c;h=e32f7ef450295e82618b4fea2271eeba6f3772e4;hb=HEAD;hp=4191b92969a9787a0ff4102b00e692b224b8b1d4;hpb=8f168ea31fb75e6dd2540c77a64224e538aa7083;p=debian%2Fpax diff --git a/file_subs.c b/file_subs.c index 4191b92..e32f7ef 100644 --- a/file_subs.c +++ b/file_subs.c @@ -382,7 +382,7 @@ node_creat(ARCHD *arcn) return(-1); } len = readlink(nm, target, - sb.st_size); + sb.st_size + 1); if (len == -1) { syswarn(0, errno, "cannot follow symlink %s in chain for %s", @@ -390,6 +390,14 @@ node_creat(ARCHD *arcn) res = -1; goto badlink; } + if (len > sb.st_size) { + syswarn(0, errno, + "symlink %s increased in size between lstat() and readlink() for %s", + nm, arcn->name); + + res = -1; + goto badlink; + } target[len] = '\0'; nm = target; }