diff options
author | Petr Písař <ppisar@redhat.com> | 2014-02-24 15:54:32 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2014-05-01 19:40:44 +0200 |
commit | d850a85b2374fe1b83779c0fc61463057eeca4ab (patch) | |
tree | 67d0bccb4b3f383e21b01719381ea878e2b6d2c9 /quotasys.h | |
parent | 7cc53f085ba8b8efe1887d1c5cfdeb7b61f904d2 (diff) | |
download | linuxquota-d850a85b2374fe1b83779c0fc61463057eeca4ab.tar.gz |
Prevent from grace period overflow in RPC transport
The RPC transports grace time as unsigned int, but the value stored
there and retrivedd from is treated as singed difference against current time.
This leads to overflow after expiring the grace time which is
presented as an enourmously large grace time instead of "none" in the
quota(1) output.
There also possible an overflow when the time difference is still
bigger than an int can represent.
This first issue is solved by explicit type cast to/from int32_t, the
second issue is fixes by limiting the value into int32_t range.
<https://sourceforge.net/p/linuxquota/bugs/115/>
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'quotasys.h')
-rw-r--r-- | quotasys.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -8,6 +8,7 @@ #define GUARD_QUOTASYS_H #include <sys/types.h> +#include <inttypes.h> #include "mntopt.h" #include "quota.h" @@ -100,6 +101,9 @@ int util2kernfmt(int fmt); /* Convert time difference between given time and current time to printable form */ void difftime2str(time_t, char *); +/* Round difference of two time_t values into int32_t */ +int32_t difftime2net(time_t later, time_t sooner); + /* Convert time to printable form */ void time2str(time_t, char *, int); |