Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ RESULT parse_cmdline_conf_file(int argc, char* argv[]) {
PR_ERR("--conf-file必须有一个参数");
return FAILURE;
} else {
int _len = strnlen(argv[i + 1], MAX_PATH);
g_prog_config.conffile = (char*)malloc(_len + 1);
strncpy(g_prog_config.conffile, argv[i + 1], _len);
g_prog_config.conffile[_len] = '\0';
g_prog_config.conffile = strndup(argv[i + 1], MAX_PATH);
}
}
}
Expand Down Expand Up @@ -132,13 +129,13 @@ static void parse_one_opt(const char* option, const char* argument) {
} else if (ISOPT("password")) {
COPY_N_ARG_TO(g_eap_config.password, PASSWORD_MAX_LEN);
} else if (ISOPT("nic")) {
COPY_N_ARG_TO(g_prog_config.ifname, IFNAMSIZ);
COPY_N_ARG_TO(g_prog_config.ifname, IFNAMSIZ - 1);
} else if (ISOPT("daemonize")) {
g_prog_config.daemon_type = atoi(argument) % 4;
} else if (ISOPT("pkt-plugin") || ISOPT("module")) {
insert_data(&g_prog_config.packet_plugin_list, (void*)argument);
} else if (ISOPT("if-impl")) {
COPY_N_ARG_TO(g_prog_config.if_impl, IFNAMSIZ);
COPY_N_ARG_TO(g_prog_config.if_impl, IFNAMSIZ - 1);
} else if (ISOPT("save")) {
g_prog_config.save_now = 1;
} else if (ISOPT("help")) {
Expand All @@ -160,7 +157,7 @@ static void parse_one_opt(const char* option, const char* argument) {
g_prog_config.kill_type = KILL_AND_START; /* 结束其他实例,本实例继续运行 */
} else if (ISOPT("proxy-lan-iface")) {
g_proxy_config.proxy_on = 1;
COPY_N_ARG_TO(g_proxy_config.lan_ifname, IFNAMSIZ);
COPY_N_ARG_TO(g_proxy_config.lan_ifname, IFNAMSIZ - 1);
} else if (ISOPT("auth-round")) {
g_prog_config.auth_round = atoi(argument);
} else if (ISOPT("pid-file")) {
Expand Down
2 changes: 1 addition & 1 deletion packet_plugin/rjv3/packet_plugin_rjv3.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void rjv3_save_config(struct _packet_plugin* this) {
conf_parser_add_value("max-dhcp-count", my_itoa(PRIV->max_dhcp_count, itoa_buf, 10));
}

static void packet_plugin_rjv3_print_banner() {
static void packet_plugin_rjv3_print_banner(struct _packet_plugin* this) {
PR_INFO("\nRJv3 for MiniEAP " VERSION "\n"
"V3 校验算法来自 hyrathb@GitHub\n"
"Hamster Tian, 2016\n\n");
Expand Down