From 51c5c28af59c19407d6602336ac7374dd1432c49 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 28 Oct 2022 11:01:20 +0200 Subject: cmd: pxe: use strdup to copy config Replace malloc and strcpy by strdup in function parse_label_kernel. Signed-off-by: Patrick Delaunay Reviewed-by: Neil Armstrong --- boot/pxe_utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'boot/pxe_utils.c') diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index b59e959..c613818 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -1179,11 +1179,10 @@ static int parse_label_kernel(char **c, struct pxe_label *label) if (!s) return 1; - label->config = malloc(strlen(s) + 1); + label->config = strdup(s); if (!label->config) return -ENOMEM; - strcpy(label->config, s); *s = 0; return 1; -- cgit v1.1