
28 Oct
2022
28 Oct
'22
11:01 a.m.
Replace malloc and strcpy by strdup in function parse_label_kernel.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
boot/pxe_utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index 756b201eda91..84e63c5cb85f 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -1180,11 +1180,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;
--
2.25.1