From ddaf08d4b8f8a216e1df1891a531b36b37e23351 Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Sat, 8 Dec 2001 02:29:24 +0000 Subject: [PATCH] make-storedata-use-unsigned-values-so-quota-cant-get-corrupted-20011203 Currently it's possible to give StoreData negative Pos/Length/FileLength arguments and thereby set the volume quota usage to arbitrary values. This patch makes these values unsigned, since negative file positions and lengths don't make sense anyway. --- src/fsint/afsint.xg | 6 +++--- src/viced/afsfileprocs.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/fsint/afsint.xg b/src/fsint/afsint.xg index 3d7063f..3140244 100644 --- a/src/fsint/afsint.xg +++ b/src/fsint/afsint.xg @@ -443,9 +443,9 @@ FetchStatus( StoreData( IN AFSFid *Fid, AFSStoreStatus *InStatus, - afs_int32 Pos, - afs_int32 Length, - afs_int32 FileLength, + afs_uint32 Pos, + afs_uint32 Length, + afs_uint32 FileLength, OUT AFSFetchStatus *OutStatus, AFSVolSync *Sync ) split = 133; diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 6b9ed5d..71d102a 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -1253,9 +1253,9 @@ SRXAFS_StoreData (tcon, Fid, InStatus, Pos, Length, FileLength, OutStatus, Sync) struct rx_connection *tcon; /* Rx connection Handle */ struct AFSFid *Fid; /* Fid of taret file */ struct AFSStoreStatus *InStatus; /* Input Status for Fid */ - afs_int32 Pos; /* Not implemented yet */ - afs_int32 Length; /* Length of data to store */ - afs_int32 FileLength; /* Length of file after store */ + afs_uint32 Pos; /* Not implemented yet */ + afs_uint32 Length; /* Length of data to store */ + afs_uint32 FileLength; /* Length of file after store */ struct AFSFetchStatus *OutStatus; /* Returned status for target fid */ { @@ -1487,8 +1487,9 @@ SRXAFS_StoreData64 (tcon, Fid, InStatus, Pos, Length, FileLength, OutStatus, Syn struct rx_connection *tcon; /* Rx connection Handle */ struct AFSFid *Fid; /* Fid of taret file */ struct AFSStoreStatus *InStatus; /* Input Status for Fid */ - afs_int64 Pos; /* Not implemented yet */ afs_int64 Length; /* Length of data to store */ - afs_int64 FileLength; /* Length of file after store */ + afs_uint64 Pos; /* Not implemented yet */ + afs_uint64 Length; /* Length of data to store */ + afs_uint64 FileLength; /* Length of file after store */ struct AFSFetchStatus *OutStatus; /* Returned status for target fid */ { int code; @@ -5247,9 +5248,9 @@ StoreData_RXStyle(volptr, targetptr, Fid, client, Call, Pos, Length, struct AFSFid *Fid; struct client *client; register struct rx_call *Call; - afs_int32 Pos; - afs_int32 Length; - afs_int32 FileLength; + afs_uint32 Pos; + afs_uint32 Length; + afs_uint32 FileLength; int sync; #if FS_STATS_DETAILED afs_int32 *a_bytesToStoreP; -- 1.9.4