summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2006-12-19 02:31:58 +0000
committerrodrigc <rodrigc@FreeBSD.org>2006-12-19 02:31:58 +0000
commit35ede48071125fd448eb638e9baec3b45ba948e7 (patch)
treedb5b10dc39fa49612ab3d7f573ed60f5f59fba5a /sys
parent24c66ef26232daf37e33d7686e8becbd2318b9ba (diff)
downloadFreeBSD-src-35ede48071125fd448eb638e9baec3b45ba948e7.zip
FreeBSD-src-35ede48071125fd448eb638e9baec3b45ba948e7.tar.gz
For big-endian version of getulong() macro, cast result to u_int32_t.
This macro was written expecting a 32-bit unsigned long, and doesn't work properly on 64-bit systems. This bug caused vn_stat() to return incorrect values for files larger than 2gb on msdosfs filesystems on 64-bit systems. PR: 106703 Submitted by: Axel Gonzalez <loox e-shell net> MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/msdosfs/bpb.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/fs/msdosfs/bpb.h b/sys/fs/msdosfs/bpb.h
index d5b86a7..1374c9a 100644
--- a/sys/fs/msdosfs/bpb.h
+++ b/sys/fs/msdosfs/bpb.h
@@ -101,7 +101,7 @@ struct bpb710 {
#define putulong(p, v) (*((u_int32_t *)(p)) = (v))
#else
#define getushort(x) (((u_int8_t *)(x))[0] + (((u_int8_t *)(x))[1] << 8))
-#define getulong(x) (((u_int8_t *)(x))[0] + (((u_int8_t *)(x))[1] << 8) \
+#define getulong(x) (u_int32_t)(((u_int8_t *)(x))[0] + (((u_int8_t *)(x))[1] << 8) \
+ (((u_int8_t *)(x))[2] << 16) \
+ (((u_int8_t *)(x))[3] << 24))
#define putushort(p, v) (((u_int8_t *)(p))[0] = (v), \
OpenPOWER on IntegriCloud