From 3416be717c93572929c58586d5658f656195cd8a Mon Sep 17 00:00:00 2001 From: Michael Tuexen <tuexen@fh-muenster.de> Date: Tue, 23 Oct 2018 16:47:24 +0200 Subject: [PATCH] Use strlcpy() instead of strncpy(). --- gtests/net/packetdrill/run_system_call.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index c20251a1..5b6c4e9f 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -4632,7 +4632,7 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall, if (check_type(val_expression->value.accept_filter_arg->af_name, EXPR_STRING, error)) { return STATUS_ERR; } - strncpy(accept_filter_arg.af_name, + strlcpy(accept_filter_arg.af_name, val_expression->value.accept_filter_arg->af_name->value.string, offsetof(struct accept_filter_arg, af_arg)); if (val_expression->value.accept_filter_arg->af_arg != NULL && @@ -4640,7 +4640,7 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall, if (check_type(val_expression->value.accept_filter_arg->af_arg, EXPR_STRING, error)) { return STATUS_ERR; } - strncpy(accept_filter_arg.af_arg, + strlcpy(accept_filter_arg.af_arg, val_expression->value.accept_filter_arg->af_arg->value.string, sizeof(struct accept_filter_arg) - offsetof(struct accept_filter_arg, af_arg)); } @@ -4655,7 +4655,7 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall, if (check_type(val_expression->value.tcp_function_set->function_set_name, EXPR_STRING, error)) { return STATUS_ERR; } - strncpy(tcp_function_set.function_set_name, + strlcpy(tcp_function_set.function_set_name, val_expression->value.tcp_function_set->function_set_name->value.string, TCP_FUNCTION_NAME_LEN_MAX); if (get_u32(val_expression->value.tcp_function_set->pcbcnt, -- GitLab