[openssh-commits] [openssh] 01/01: Do shadow expiry calcs using "long long".

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Feb 27 17:30:34 AEDT 2023


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit b0fd60a9de62a03189ad57d0c07f0ac51dc00e95
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Mon Feb 27 17:28:59 2023 +1100

    Do shadow expiry calcs using "long long".
    
    Coverity flags these as potentially not 64bit time_t safe so use
    long long for the calculations and debug output.  ok djm@
---
 auth-shadow.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/auth-shadow.c b/auth-shadow.c
index c77ee8da..e1eb68bc 100644
--- a/auth-shadow.c
+++ b/auth-shadow.c
@@ -56,13 +56,13 @@ int
 auth_shadow_acctexpired(struct spwd *spw)
 {
 	time_t today;
-	int daysleft;
+	long long daysleft;
 	int r;
 
 	today = time(NULL) / DAY;
 	daysleft = spw->sp_expire - today;
-	debug3("%s: today %d sp_expire %d days left %d", __func__, (int)today,
-	    (int)spw->sp_expire, daysleft);
+	debug3("%s: today %lld sp_expire %lld days left %lld", __func__,
+	    (long long)today, (long long)spw->sp_expire, daysleft);
 
 	if (spw->sp_expire == -1) {
 		debug3("account expiration disabled");
@@ -70,9 +70,9 @@ auth_shadow_acctexpired(struct spwd *spw)
 		logit("Account %.100s has expired", spw->sp_namp);
 		return 1;
 	} else if (daysleft <= spw->sp_warn) {
-		debug3("account will expire in %d days", daysleft);
+		debug3("account will expire in %lld days", daysleft);
 		if ((r = sshbuf_putf(loginmsg, 
-		    "Your account will expire in %d day%s.\n", daysleft,
+		    "Your account will expire in %lld day%s.\n", daysleft,
 		    daysleft == 1 ? "" : "s")) != 0)
 			fatal("%s: buffer error: %s", __func__, ssh_err(r));
 	}

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list