Increase size of log buffer to a safe value

This commit is contained in:
Silvan Calarco 2021-02-17 20:36:50 +01:00
parent 32a0b172de
commit 80d1ad8e46

View File

@ -447,7 +447,7 @@ void log_debug_set(int value) {
void logmsg(int level, const char *msg, ...) {
va_list ap;
static char oldmsg[20][256];
static char oldmsg[20][PATH_MAX];
static int curroldmsg = 0;
char newmsg[PATH_MAX];
int i;
@ -458,7 +458,7 @@ void logmsg(int level, const char *msg, ...) {
for (i = 0; i < 20; i++) {
/* only log the same message once */
if (!strncmp(newmsg,(char*)&(oldmsg[i]),256)) return;
if (!strncmp(newmsg,(char*)&(oldmsg[i]),PATH_MAX)) return;
}
switch (level) {
@ -480,7 +480,7 @@ void logmsg(int level, const char *msg, ...) {
break;
}
if ((level == LOG_WARNING) || (level == LOG_ERROR)) {
strncpy(oldmsg[curroldmsg++],newmsg,256);
strncpy(oldmsg[curroldmsg++],newmsg,PATH_MAX);
if (curroldmsg >= 20) curroldmsg = 0;
}
}