Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cfgfile parser malloc problem and ipvsadm improvement #906

Merged
merged 2 commits into from
Sep 6, 2023
Merged
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
4 changes: 2 additions & 2 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ void *set_value(vector_t tokens)
strncat(alloc, str, strlen(str));
}
} else {
alloc = MALLOC(sizeof(char *) * (size + 1));
memcpy(alloc, str, size);
alloc = MALLOC(sizeof(char) * (size + 1));
memcpy(alloc, str, size + 1);
roykingz marked this conversation as resolved.
Show resolved Hide resolved
}

return alloc;
Expand Down
6 changes: 5 additions & 1 deletion tools/ipvsadm/ipvsadm.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
case 't':
case 'u':
case 'q':
case '1':
set_option(options, OPT_SERVICE);
if (c == 't') {
ce->dpvs_svc.proto = IPPROTO_TCP;
Expand Down Expand Up @@ -1721,7 +1722,10 @@ static void usage_exit(const char *program, const int exit_status)
" --dest-check CHECK_CONF config health check, inhibit scheduling to failed backends\n"
" CHECK_CONF:=disable|default(passive)|DETAIL(passive)|tcp|udp|ping, DETAIL:=UPDOWN|DOWNONLY\n"
" UPDOWN:=down_retry,up_confirm,down_wait,inhibit_min-inhibit_max, for example, the default is 1,1,3s,5-3600s\n"
" DOWNONLY:=down_retry,down_wait, for example, --dest-check=1,3s\n",
" DOWNONLY:=down_retry,down_wait, for example, --dest-check=1,3s\n"
" --laddr -z local-ip local IP\n"
" --blklst -k blacklist-ip blacklist IP for specific service\n"
" --whtlst -2 whitelist-ip whitelist IP for specific service\n",
DEF_SCHED);

exit(exit_status);
Expand Down
Loading