From: nekral-guest Date: Thu, 14 Jul 2011 14:03:19 +0000 (+0000) Subject: * src/passwd.c: Overflow when computing the number of days based X-Git-Tag: 4.1.5~153 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8bce7fc0169ac427e03711c221569e227b585753;p=shadow * src/passwd.c: Overflow when computing the number of days based on the scaling. Use of long long needed. --- diff --git a/ChangeLog b/ChangeLog index 30c639a5..183325fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-14 Nicolas François + + * src/passwd.c: Overflow when computing the number of days based + on the scaling. Use of long long needed. + 2011-07-14 Nicolas François * NEWS, lib/commonio.h, lib/commonio.c: Additional messages to diff --git a/src/passwd.c b/src/passwd.c index 2a357f2a..be70d51d 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -458,14 +458,14 @@ static void print_status (const struct passwd *pw) sp = getspnam (pw->pw_name); /* local, no need for xgetspnam */ if (NULL != sp) { - (void) printf ("%s %s %s %ld %ld %ld %ld\n", + (void) printf ("%s %s %s %lld %lld %lld %lld\n", pw->pw_name, pw_status (sp->sp_pwdp), date_to_str (sp->sp_lstchg * SCALE), - (sp->sp_min * SCALE) / DAY, - (sp->sp_max * SCALE) / DAY, - (sp->sp_warn * SCALE) / DAY, - (sp->sp_inact * SCALE) / DAY); + ((long long)sp->sp_min * SCALE) / DAY, + ((long long)sp->sp_max * SCALE) / DAY, + ((long long)sp->sp_warn * SCALE) / DAY, + ((long long)sp->sp_inact * SCALE) / DAY); } else { (void) printf ("%s %s\n", pw->pw_name, pw_status (pw->pw_passwd));