mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Always check for usage underflow when removing a file in storage.c
Part of #22424.
This commit is contained in:
parent
f6841ae263
commit
9e36b0beb9
@ -425,7 +425,9 @@ storage_dir_remove_file(storage_dir_t *d,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (unlink(ipath) == 0) {
|
if (unlink(ipath) == 0) {
|
||||||
|
if (! BUG(d->usage < size)) {
|
||||||
d->usage -= size;
|
d->usage -= size;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log_warn(LD_FS, "Unable to unlink %s", escaped(path));
|
log_warn(LD_FS, "Unable to unlink %s", escaped(path));
|
||||||
tor_free(path);
|
tor_free(path);
|
||||||
|
Loading…
Reference in New Issue
Block a user