1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 17:14:46 +02:00

Fix CHATHISTORY BETWEEN accidentally including a message too much

Reported by progval in https://bugs.unrealircd.org/view.php?id=5952
This commit is contained in:
Bram Matthys
2023-05-28 11:07:10 +02:00
parent a4d7ca022e
commit 5e64991296
+16 -2
View File
@@ -1023,9 +1023,23 @@ static int hbm_return_between(HistoryResult *r, HistoryLogObject *h, HistoryFilt
direction = hbm_return_between_figure_out_direction(h, filter);
if (direction == 1)
{
return hbm_return_after(r, h, filter);
else if (direction == 0)
return hbm_return_before(r, h, filter);
} else
if (direction == 0)
{
/* Create a temporary filter, swapping directions */
char *x, *y;
HistoryFilter f;
memset(&f, 0, sizeof(f));
f.cmd = HFC_BEFORE;
f.limit = filter->limit;
f.timestamp_a = filter->timestamp_b;
f.timestamp_b = filter->timestamp_a;
f.msgid_a = filter->msgid_b;
f.msgid_b = filter->msgid_a;
return hbm_return_after(r, h, &f);
}
/* else direction is -1 which means not found / invalid */
return 0;