Fixes for systems with 64-bit time (#8662)
Some operating systems (e.g., NetBSD and OpenBSD) have switched to using a 64-bit integer for time_t on all platforms. This results in currently harmless compiler warnings due to potential truncation. These changes fix these minor portability concerns. * Fix format string for systems with 64 bit time * use llabs to avoid truncation with 64 bit time
This commit is contained in:
parent
6097d14d4d
commit
169be0426c
@ -473,7 +473,7 @@ NULL
|
|||||||
} else if (!strcasecmp(c->argv[1]->ptr,"segfault")) {
|
} else if (!strcasecmp(c->argv[1]->ptr,"segfault")) {
|
||||||
*((char*)-1) = 'x';
|
*((char*)-1) = 'x';
|
||||||
} else if (!strcasecmp(c->argv[1]->ptr,"panic")) {
|
} else if (!strcasecmp(c->argv[1]->ptr,"panic")) {
|
||||||
serverPanic("DEBUG PANIC called at Unix time %ld", time(NULL));
|
serverPanic("DEBUG PANIC called at Unix time %lld", (long long)time(NULL));
|
||||||
} else if (!strcasecmp(c->argv[1]->ptr,"restart") ||
|
} else if (!strcasecmp(c->argv[1]->ptr,"restart") ||
|
||||||
!strcasecmp(c->argv[1]->ptr,"crash-and-recover"))
|
!strcasecmp(c->argv[1]->ptr,"crash-and-recover"))
|
||||||
{
|
{
|
||||||
|
@ -3008,7 +3008,7 @@ void securityWarningCommand(client *c) {
|
|||||||
static time_t logged_time;
|
static time_t logged_time;
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
if (labs(now-logged_time) > 60) {
|
if (llabs(now-logged_time) > 60) {
|
||||||
serverLog(LL_WARNING,"Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis. This is likely due to an attacker attempting to use Cross Protocol Scripting to compromise your Redis instance. Connection aborted.");
|
serverLog(LL_WARNING,"Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis. This is likely due to an attacker attempting to use Cross Protocol Scripting to compromise your Redis instance. Connection aborted.");
|
||||||
logged_time = now;
|
logged_time = now;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user