From adbc0311a37bf370359a97be01116c590d466235 Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Wed, 10 Sep 2014 22:37:20 +0000 Subject: [PATCH] Fix a bug which could break extended attributes in a dump output. This occurred when a file was >892kB long and had a large data (>1kB) in the extended attributes. Reported by: Masashi Toriumi Reviewed by: mckusick --- sbin/dump/traverse.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index 8258f079c0ed..8a9a378dfc40 100644 --- a/sbin/dump/traverse.c +++ b/sbin/dump/traverse.c @@ -673,7 +673,12 @@ ufs2_blksout(union dinode *dp, ufs2_daddr_t *blkp, int frags, ino_t ino, */ blks = howmany(frags * sblock->fs_fsize, TP_BSIZE); if (last) { - resid = howmany(fragoff(sblock, dp->dp2.di_size), TP_BSIZE); + if (writingextdata) + resid = howmany(fragoff(sblock, spcl.c_extsize), + TP_BSIZE); + else + resid = howmany(fragoff(sblock, dp->dp2.di_size), + TP_BSIZE); if (resid > 0) blks -= howmany(sblock->fs_fsize, TP_BSIZE) - resid; }