diff options
author | iedowse <iedowse@FreeBSD.org> | 2001-08-26 01:25:12 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2001-08-26 01:25:12 +0000 |
commit | c8ef91ce6cf3cd4ae61ef32fb9d9bdfb7cfb4603 (patch) | |
tree | c0efb627e00a6fa545506e51afb35b29836a816a /lib/libc/stdio/setbuffer.c | |
parent | 8638e55f32ea751d1be5fac53c95af56bdf048ba (diff) | |
download | FreeBSD-src-c8ef91ce6cf3cd4ae61ef32fb9d9bdfb7cfb4603.zip FreeBSD-src-c8ef91ce6cf3cd4ae61ef32fb9d9bdfb7cfb4603.tar.gz |
When compacting directories, ufs_direnter() always trusted DIRSIZ()
to supply the number of bytes to be bcopy()'d to move an entry. If
d_ino == 0 however, DIRSIZ() is not guaranteed to return a sensible
length, so ufs_direnter could end up corrupting a directory during
compaction. In practice I believe this can only happen after fsck_ffs
has fixed a previously-corrupted directory.
We now deal with any mid-block unused entries specially to avoid
using DIRSIZ() or bcopy() on such entries. We also ensure that the
variables 'dsize' and 'spacefree' contain meaningful values at all
times. Add a few comments to describe better this intricate piece
of code.
The special handling of mid-block unused entries makes the dirhash-
specific bugfix in the previous revision (1.53) now uncecessary,
so this change removes it.
Reviewed by: mckusick
Diffstat (limited to 'lib/libc/stdio/setbuffer.c')
0 files changed, 0 insertions, 0 deletions