Fix memory corruption in USTAR::SymLink

This commit is contained in:
EnderIce2 2024-07-09 03:33:11 +03:00
parent 51ea074b60
commit 4d201a5264
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -341,8 +341,9 @@ namespace vfs
if (ret < 0)
return ret;
USTARInode *node = (USTARInode *)Result;
strncpy(node->Header->link, Target, sizeof(node->Header->link));
USTARInode *node = (USTARInode *)*Result;
FileHeader *hdr = node->Header;
strncpy(hdr->link, Target, MIN(sizeof(hdr->link) - 1, strlen(Target)));
return 0;
}