summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/c/fastforge_logic.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/c/fastforge_logic.c b/src/c/fastforge_logic.c
index 8a66804..a21ae36 100644
--- a/src/c/fastforge_logic.c
+++ b/src/c/fastforge_logic.c
@@ -10,6 +10,7 @@ typedef time_t ff_sys_time_t;
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
time_t entry_duration_seconds(const FastEntry *entry) {
@@ -128,6 +129,10 @@ void fastforge_streak_recompute(const FastEntry *entries, int count, time_t now,
return;
}
+ if ((size_t)count > SIZE_MAX / sizeof(time_t)) {
+ return;
+ }
+
size_t completion_capacity = (size_t)count;
time_t *completion_days = malloc(completion_capacity * sizeof(*completion_days));
if (!completion_days) {