Skip to content

Commit 92bee44

Browse files
committed
conf: path buffer size is small.
1 parent 9f6e9ad commit 92bee44

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/dns_conf/conf_file.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <errno.h>
2828
#include <getopt.h>
29+
#include <limits.h>
2930
#include <stdio.h>
3031

3132
struct conf_file_path {
@@ -69,8 +70,8 @@ static int conf_file_check_duplicate(const char *conf_file)
6970

7071
static int conf_additional_file(const char *conf_file)
7172
{
72-
char file_path[DNS_MAX_PATH];
73-
char file_path_dir[DNS_MAX_PATH];
73+
char file_path[PATH_MAX];
74+
char file_path_dir[PATH_MAX];
7475

7576
if (conf_file == NULL) {
7677
return -1;

src/dns_conf/set_file.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "smartdns/lib/stringutil.h"
2222
#include "smartdns/util.h"
2323

24+
#include <limits.h>
2425
#include <errno.h>
2526
#include <getopt.h>
2627
#include <glob.h>
@@ -67,8 +68,8 @@ int _config_set_rule_each_from_list(const char *file, set_rule_add_func callback
6768

6869
int _config_foreach_file(const char *file_pattern, int (*callback)(const char *file, void *priv), void *priv)
6970
{
70-
char file_path[DNS_MAX_PATH];
71-
char file_path_dir[DNS_MAX_PATH];
71+
char file_path[PATH_MAX];
72+
char file_path_dir[PATH_MAX];
7273
glob_t globbuf = {0};
7374

7475
if (file_pattern == NULL) {

src/utils/stack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <dlfcn.h>
2525
#include <errno.h>
2626
#include <stdint.h>
27+
#include <unistd.h>
2728
#include <signal.h>
2829

2930
void bug_ext(const char *file, int line, const char *func, const char *errfmt, ...)

0 commit comments

Comments
 (0)