From 2f07989f4e2f67ae6f2b47b1a4f1140777033ded Mon Sep 17 00:00:00 2001 From: Andre Watan <96546018+watan104@users.noreply.github.com> Date: Sat, 7 Jun 2025 01:06:09 +0300 Subject: [PATCH] gen_init_cpio.c: fix buffer allocation size Fix potential buffer overflow by allocating space for null terminator in hardlink name buffer. --- usr/gen_init_cpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c index edcdb8abfa31ca..3774e09fa30cd5 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c @@ -476,7 +476,7 @@ static int cpio_mkfile_line(const char *line) int len; int nend; - dname = malloc(strlen(line)); + dname = malloc(strlen(line) + 1); if (!dname) { fprintf (stderr, "out of memory (%d)\n", dname_len); goto fail;