From 1b4b0b7576475daf540be15ef759e9a999671a1b Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 2 May 2010 09:21:48 -0400 Subject: [PATCH] Windows: correct "fs quota" pioctl validation check The validation check for the response from the GetVolumeStatus pioctl is incorrect. The response is not simply a VolumeStatus structure but also several C strings appended to it. LICENSE MIT Change-Id: Ieb0c0cd166f85e073431890f51f735958776eb74 Reviewed-on: http://gerrit.openafs.org/1883 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/fs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/WINNT/afsd/fs.c b/src/WINNT/afsd/fs.c index fd9d915..340c34d 100644 --- a/src/WINNT/afsd/fs.c +++ b/src/WINNT/afsd/fs.c @@ -1891,12 +1891,16 @@ QuotaCmd(struct cmd_syndesc *as, void *arock) blob.in_size = 0; blob.out = space; code = pioctl_utf8(ti->data, VIOCGETVOLSTAT, &blob, 1); - if (code || blob.out_size != sizeof(*status)) { + /* + * The response is VolumeStatus, volume name, offline message, and motd + */ + if (code || blob.out_size < sizeof(*status)) { Die(errno, ti->data); error = 1; continue; } - status = (VolumeStatus *)space; + + status = (VolumeStatus *)space; if (status->MaxQuota) quotaPct = ((((double)status->BlocksInUse)/status->MaxQuota) * 100.0); else -- 1.9.4