All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs-utils 4 of 10 - Replaced a memcopy with explicit assignment
@ 2005-09-23 14:45 Steve Dickson
  0 siblings, 0 replies; only message in thread
From: Steve Dickson @ 2005-09-23 14:45 UTC (permalink / raw)
  To: nfs

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: nfs-utils-1.0.6-rquotad-overflow.patch --]
[-- Type: text/x-patch, Size: 1556 bytes --]

Replaced a memcopy with explicit assignments
in getquotainfo() of rquotad to fix potential overflow
that can occur on 64bit machines. (bz 138068)

Details can be found in:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=138063

Signed-off-by: Steve Dickson <steved@redhat.com>
---------
--- nfs-utils-1.0.6/utils/rquotad/rquota_server.c.org	2001-06-27 12:45:56.000000000 -0400
+++ nfs-utils-1.0.6/utils/rquotad/rquota_server.c	2004-11-08 16:06:11.000000000 -0500
@@ -76,6 +76,7 @@ getquota_rslt *getquotainfo(int flags, c
    char *pathname, *qfpathname;
    int fd, err, id, type;
    struct stat stm, stn;
+   struct rquota *rquota;
 
    /*
     * First check authentication.
@@ -168,8 +169,16 @@ getquota_rslt *getquotainfo(int flags, c
           * Make a copy of the info into the last part of the remote quota
           * struct which is exactly the same.
           */
-         memcpy((caddr_t *)&result.getquota_rslt_u.gqr_rquota.rq_bhardlimit,
-                (caddr_t *)&dq_dqb, sizeof(struct dqblk));
+
+         rquota = &result.getquota_rslt_u.gqr_rquota;
+         rquota->rq_bhardlimit = dq_dqb.dqb_bhardlimit;
+         rquota->rq_bsoftlimit = dq_dqb.dqb_bsoftlimit;;
+         rquota->rq_curblocks = dq_dqb.dqb_curblocks;
+         rquota->rq_fhardlimit = dq_dqb.dqb_ihardlimit;
+         rquota->rq_fsoftlimit = dq_dqb.dqb_isoftlimit;
+         rquota->rq_curfiles = dq_dqb.dqb_curinodes;
+         rquota->rq_btimeleft = dq_dqb.dqb_btime;
+         rquota->rq_ftimeleft = dq_dqb.dqb_itime;
 
          return(&result);
       }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-23 14:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-23 14:45 [PATCH] nfs-utils 4 of 10 - Replaced a memcopy with explicit assignment Steve Dickson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.