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;