diff --git a/src/eggdrop.h b/src/eggdrop.h index 0b7015648..5bb1da287 100644 --- a/src/eggdrop.h +++ b/src/eggdrop.h @@ -184,6 +184,10 @@ # endif #endif +#ifndef PATH_MAX +# define PATH_MAX 4096 +#endif + /* Almost every module needs some sort of time thingy, so... */ #ifdef TIME_WITH_SYS_TIME # include diff --git a/src/misc.c b/src/misc.c index 7c0b9022d..64543cc51 100644 --- a/src/misc.c +++ b/src/misc.c @@ -518,7 +518,7 @@ void putlog (int type, char *chname, const char *format, ...) { static int inhere = 0; int i, tsl = 0; - char s[LOGLINELEN], s1[LOGLINELEN], *out, ct[81], *s2, stamp[34]; + char s[LOGLINELEN], path[PATH_MAX], *out, ct[81], *s2, stamp[34]; va_list va; time_t now2 = time(NULL); static time_t now2_last = 0; /* cache expensive localtime() */ @@ -582,8 +582,8 @@ void putlog (int type, char *chname, const char *format, ...) if (logs[i].f == NULL) { /* Open this logfile */ if (keep_all_logs) { - egg_snprintf(s1, 256, "%s%s", logs[i].filename, ct); - logs[i].f = fopen(s1, "a"); + snprintf(path, sizeof path, "%s%s", logs[i].filename, ct); + logs[i].f = fopen(path, "a"); } else logs[i].f = fopen(logs[i].filename, "a"); } diff --git a/src/mod/ident.mod/ident.c b/src/mod/ident.mod/ident.c index 274bf6154..e9b17f09c 100644 --- a/src/mod/ident.mod/ident.c +++ b/src/mod/ident.mod/ident.c @@ -107,7 +107,7 @@ static void ident_oidentd() FILE *fd; long filesize; char *data = NULL; - char path[121], line[256], buf[256], identstr[256]; + char path[PATH_MAX], line[256], buf[256], identstr[256]; char s[EGG_INET_ADDRSTRLEN]; int ret, prevtime, servidx, i; socklen_t namelen;