Fix truncation to 0 bytes

svn path=/trunk/; revision=4040
This commit is contained in:
Gé van Geldorp 2003-01-19 01:06:09 +00:00
parent 10d48ac01e
commit 96fdaea58f

View file

@ -1,4 +1,4 @@
/* $Id: finfo.c,v 1.24 2003/01/11 16:00:16 hbirr Exp $ /* $Id: finfo.c,v 1.25 2003/01/19 01:06:09 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -472,25 +472,29 @@ VfatSetAllocationSizeInformation(PFILE_OBJECT FileObject,
} }
} }
} }
else if (NewSize <= Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize) else if (NewSize + ClusterSize <= Fcb->RFCB.AllocationSize.u.LowPart)
{ {
if (NewSize > 0) if (NewSize > 0)
{ {
Status = OffsetToCluster(DeviceExt, Fcb, Cluster, Status = OffsetToCluster(DeviceExt, Fcb, Cluster,
ROUND_DOWN(NewSize - 1, ClusterSize), ROUND_DOWN(NewSize - 1, ClusterSize),
&Cluster, FALSE); &Cluster, FALSE);
} NCluster = Cluster;
NCluster = Cluster; Status = NextCluster (DeviceExt, Fcb, Cluster, &NCluster, FALSE);
Status = NextCluster (DeviceExt, Fcb, Cluster, &NCluster, FALSE); WriteCluster(DeviceExt, Cluster, 0xffffffff);
WriteCluster(DeviceExt, Cluster, 0xffffffff); Cluster = NCluster;
Cluster = NCluster; }
while (Cluster != 0xffffffff) else
{ {
NextCluster (DeviceExt, Fcb, Cluster, &NCluster, FALSE); Cluster = FirstCluster;
WriteCluster (DeviceExt, Cluster, 0); }
Cluster = NCluster; while (0xffffffff != Cluster && 0 != Cluster)
} {
NextCluster (DeviceExt, Fcb, Cluster, &NCluster, FALSE);
WriteCluster (DeviceExt, Cluster, 0);
Cluster = NCluster;
}
} }
if (!vfatFCBIsDirectory(Fcb)) if (!vfatFCBIsDirectory(Fcb))
{ {