use PATH_MAX
Include <limits.h> and use the PATH_MAX macro to define the length of buffers containing paths to make it constistent. (It's not supposed to fit all possible paths.)
This commit is contained in:
parent
903fa247f8
commit
2fc8edacb8
4 changed files with 5 additions and 4 deletions
|
@ -266,7 +266,7 @@ LOG_FileWrite(LOG_FileID id, const char *format, ...)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!logfiles[id].file) {
|
if (!logfiles[id].file) {
|
||||||
char filename[512], *logdir = CNF_GetLogDir();
|
char filename[PATH_MAX], *logdir = CNF_GetLogDir();
|
||||||
|
|
||||||
if (logdir[0] == '\0') {
|
if (logdir[0] == '\0') {
|
||||||
LOG(LOGS_WARN, "logdir not specified");
|
LOG(LOGS_WARN, "logdir not specified");
|
||||||
|
|
|
@ -129,7 +129,7 @@ close_socket(void)
|
||||||
static int
|
static int
|
||||||
open_socket(void)
|
open_socket(void)
|
||||||
{
|
{
|
||||||
char path[1024];
|
char path[PATH_MAX];
|
||||||
|
|
||||||
if (sock_fd != INVALID_SOCK_FD)
|
if (sock_fd != INVALID_SOCK_FD)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -1153,7 +1153,7 @@ static
|
||||||
FILE *open_dumpfile(SRC_Instance inst, const char *mode)
|
FILE *open_dumpfile(SRC_Instance inst, const char *mode)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char filename[1024], *dumpdir;
|
char filename[PATH_MAX], *dumpdir;
|
||||||
|
|
||||||
dumpdir = CNF_GetDumpDir();
|
dumpdir = CNF_GetDumpDir();
|
||||||
if (dumpdir[0] == '\0') {
|
if (dumpdir[0] == '\0') {
|
||||||
|
@ -1225,7 +1225,7 @@ SRC_ReloadSources(void)
|
||||||
void
|
void
|
||||||
SRC_RemoveDumpFiles(void)
|
SRC_RemoveDumpFiles(void)
|
||||||
{
|
{
|
||||||
char pattern[1024], name[64], *dumpdir, *s;
|
char pattern[PATH_MAX], name[64], *dumpdir, *s;
|
||||||
IPAddr ip_addr;
|
IPAddr ip_addr;
|
||||||
glob_t gl;
|
glob_t gl;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
Loading…
Reference in a new issue