diff --git a/Changes b/Changes index 0c59f55b2..e451fb2f9 100644 --- a/Changes +++ b/Changes @@ -3120,3 +3120,4 @@ This is the 3.2 fixes branch. - Fixed a little problem in ./unreal to move ircd.pid.bak to ircd.pid of starting failed. Fixed by fez (#0001739) - Made it so chg* command usage is not logged from U:lines. Reported by diskman1 (#0001718) +- Changed int_to_base64() warning so it has less false positives (#0001797). diff --git a/src/aln.c b/src/aln.c index 70abf2874..8ca4e38e2 100644 --- a/src/aln.c +++ b/src/aln.c @@ -232,13 +232,14 @@ static inline char *int_to_base64(long val) base64buf[i] = '\0'; - /* Temporary debugging code.. remove before 2038 ;p */ - if (val > 2147483646) + /* Temporary debugging code.. remove before 2038 ;p. + * This might happen in case of 64bit longs (opteron/ia64), + * if the value is then too large it can easily lead to + * a buffer underflow and thus to a crash. -- Syzop + */ + if (val > 2147483647L) { - snprintf(trouble_info, sizeof(trouble_info), - "[BUG] int_to_base64() called for insane value %ld. Please report!", val); - ircd_log(LOG_ERROR, "%s", trouble_info); - val = 2147483647L; /* prevent buffer overflow */ + abort(); } do