diff options
author | Roland McGrath <roland@gnu.org> | 1999-08-20 05:33:12 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1999-08-20 05:33:12 +0000 |
commit | 40f753cd553dff749744910f24e34c6f743e64c6 (patch) | |
tree | f2f3cf5bb8f82e0482f8d56165be7e942bc8e7df /serverboot | |
parent | a8bfe21ec2c3d953ff9fa0bc3ee4df78edb60597 (diff) |
1999-08-20 Roland McGrath <roland@baalperazim.frob.com>
* bootstrap.c (parse_script): Add one to the buffer size so we can
null-terminate after the end of the file.
Diffstat (limited to 'serverboot')
-rw-r--r-- | serverboot/bootstrap.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/serverboot/bootstrap.c b/serverboot/bootstrap.c index 292bf81b..3057e0a7 100644 --- a/serverboot/bootstrap.c +++ b/serverboot/bootstrap.c @@ -437,7 +437,7 @@ parse_script (struct file *f) int amt, fd, err; int n = 0; - buf = malloc (f->f_size); + buf = malloc (f->f_size + 1); /* add one for null terminator we will write */ if (read_file (f, 0, buf, f->f_size, 0)) panic ("bootstrap: error reading boot script file"); @@ -445,7 +445,7 @@ parse_script (struct file *f) while (1) { while (p < buf + f->f_size && *p != '\n') - p++; + p++; *p = '\0'; err = boot_script_parse_line (line); if (err) @@ -453,7 +453,6 @@ parse_script (struct file *f) if (p == buf + f->f_size) break; line = ++p; - } free (buf); } |