CheckInode() could find an invalid data stream for symlinks without a data stream;

the data stream area is reused as link data in this case.
Reported by Robert Szeleney.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19120 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-10-25 13:16:43 +00:00
parent bd50618697
commit a9831b73ed
2 changed files with 16 additions and 0 deletions
@@ -1202,6 +1202,14 @@ BlockAllocator::CheckInode(Inode *inode, check_control *control)
if (status < B_OK)
return status;
if (inode->IsSymLink() && (inode->Flags() & INODE_LONG_SYMLINK) == 0) {
// symlinks may not have a valid data stream
if (strlen(inode->Node().short_symlink) >= SHORT_SYMLINK_NAME_LENGTH)
return B_BAD_DATA;
return B_OK;
}
data_stream *data = &inode->Node().data;
// check the direct range
@@ -1140,6 +1140,14 @@ BlockAllocator::CheckInode(Inode *inode, check_control *control)
if (status < B_OK)
return status;
if (inode->IsSymLink() && (inode->Flags() & INODE_LONG_SYMLINK) == 0) {
// symlinks may not have a valid data stream
if (strlen(inode->Node()->short_symlink) >= SHORT_SYMLINK_NAME_LENGTH)
return B_BAD_DATA;
return B_OK;
}
data_stream *data = &inode->Node()->data;
// check the direct range