logging: days in months calculation fix
Array 'days_in_month' of size 12 may use index value bigger then count of its elements. Signed-off-by: PawelX Dobrowolski <pawelx.dobrowolski@intel.com>
This commit is contained in:
parent
20ed64be62
commit
07052aba13
1 changed files with 1 additions and 1 deletions
|
@ -194,7 +194,7 @@ static void __attribute__((unused)) get_YMD_from_seconds(uint64_t seconds,
|
||||||
output_date->year++;
|
output_date->year++;
|
||||||
}
|
}
|
||||||
/* compute the proper month */
|
/* compute the proper month */
|
||||||
for (i = 0; i < sizeof(days_in_month); i++) {
|
for (i = 0; i < ARRAY_SIZE(days_in_month); i++) {
|
||||||
tmp = ((i == 1) && is_leap_year(output_date->year)) ?
|
tmp = ((i == 1) && is_leap_year(output_date->year)) ?
|
||||||
(days_in_month[i] + 1) * SECONDS_IN_DAY :
|
(days_in_month[i] + 1) * SECONDS_IN_DAY :
|
||||||
days_in_month[i] * SECONDS_IN_DAY;
|
days_in_month[i] * SECONDS_IN_DAY;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue