fix: security issues
This commit is contained in:
+1
-1
@@ -61,7 +61,7 @@ bool file_update(File *file) {
|
|||||||
// close file
|
// close file
|
||||||
fclose(file_pointer);
|
fclose(file_pointer);
|
||||||
// append null byte
|
// append null byte
|
||||||
file->content[length] = '\0';
|
file->content[length] = 0;
|
||||||
// read last update time
|
// read last update time
|
||||||
file->last_write = get_file_time(file);
|
file->last_write = get_file_time(file);
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ static long get_average_tap_duration(Tempo tempo) {
|
|||||||
running_total += tempo.tap_durations[i];
|
running_total += tempo.tap_durations[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (amount == 0) {
|
||||||
|
amount = 1; // should never happen
|
||||||
|
}
|
||||||
|
|
||||||
average_tap_duration = running_total / amount;
|
average_tap_duration = running_total / amount;
|
||||||
if (average_tap_duration < MIN_BEAT_LENGTH) {
|
if (average_tap_duration < MIN_BEAT_LENGTH) {
|
||||||
return MIN_BEAT_LENGTH;
|
return MIN_BEAT_LENGTH;
|
||||||
|
|||||||
Reference in New Issue
Block a user