]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Quiet coverity (CID #1503969, #1504008) (#4475)
authorJames Jones <jejones3141@gmail.com>
Fri, 29 Apr 2022 12:34:07 +0000 (07:34 -0500)
committerGitHub <noreply@github.com>
Fri, 29 Apr 2022 12:34:07 +0000 (08:34 -0400)
timestr_match() converts time from the beginning of the week in
a struct tm to minutes. Coverity doesn't consider the bounds
on those values (tm_wday and tm_hour), and thus warns of possible
overflow.

src/modules/rlm_logintime/timestr.c

index 009ac71271b4e73ffd2dc2bb2bb7915c20524c2d..7fd4125835f5b91935d2f79cb467b7bed3aaba2c 100644 (file)
@@ -210,7 +210,7 @@ int timestr_match(fr_time_delta_t *out, char const *tmstr, fr_time_t when)
        time_t t = fr_time_to_sec(when);
 
        tm = localtime_r(&t, &s_tm);
-       now = tm->tm_wday * DAYMIN + tm->tm_hour * 60 + tm->tm_min;
+       now = (int64_t) (tm->tm_wday) * DAYMIN + (int64_t) (tm->tm_hour) * 60 + tm->tm_min;
        tot = 0;
        memset(bitmap, 0, sizeof(bitmap));
        week_fill(bitmap, tmstr);