1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-02 09:26:39 +02:00

Fix crash in tkldb on 32 bit systems. Reported by k4be.

Also, get rid of compiler warnings (we can use C99 types now).
This commit is contained in:
Bram Matthys
2020-04-25 09:26:56 +02:00
parent 29b691f9b6
commit 0c080b3982
3 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ long clicap_allocate_cap(void)
long v = 1;
ClientCapability *clicap;
for (v=1; v < 2147483648; v = v * 2)
for (v=1; v < LONG_MAX; v = v * 2)
{
unsigned char found = 0;
for (clicap = clicaps; clicap; clicap = clicap->next)
+8 -4
View File
@@ -402,9 +402,10 @@ int read_tkldb(void)
FILE *fd;
TKL *tkl = NULL;
uint32_t magic = 0;
uint32_t version;
uint64_t cnt;
uint64_t tklcount = 0;
uint32_t version;
uint64_t v;
int added_cnt = 0;
char c;
char *str;
@@ -483,8 +484,10 @@ int read_tkldb(void)
/* Read the common types (same for all TKLs) */
R_SAFE(read_str(fd, &tkl->set_by));
R_SAFE(read_int64(fd, &tkl->set_at));
R_SAFE(read_int64(fd, &tkl->expire_at));
R_SAFE(read_int64(fd, &v));
tkl->set_at = v;
R_SAFE(read_int64(fd, &v));
tkl->expire_at = v;
/* Save some CPU... if it's already expired then don't bother adding */
if (tkl->expire_at != 0 && tkl->expire_at <= TStime())
@@ -645,7 +648,8 @@ int read_tkldb(void)
}
R_SAFE(read_str(fd, &tkl->ptr.spamfilter->tkl_reason));
R_SAFE(read_int64(fd, &tkl->ptr.spamfilter->tkl_duration));
R_SAFE(read_int64(fd, &v));
tkl->ptr.spamfilter->tkl_duration = v;
if (find_tkl_spamfilter(tkl->type, tkl->ptr.spamfilter->match->str,
tkl->ptr.spamfilter->action,
+1 -1
View File
@@ -124,7 +124,7 @@ long set_usermode(char *umode)
/** Convert a target pointer to an 8 bit hash, used for target limiting. */
unsigned char hash_target(void *target)
{
unsigned long long v = (unsigned long long)target;
uintptr_t v = (uintptr_t)target;
/* ircu does >> 16 and 8 but since our sizeof(Client) is
* towards 512 (and hence the alignment), that bit is useless.
* So we do >> 17 and 9.