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 | 3ab9974fa2f0f3877b6af3e3563657d717aefd40 (patch) | |
tree | 75e01477a32bccbdb31bd8fe43d0f2acf9bf2489 | |
parent | 7a8b3db2b4fe449397a08d3887d47b950a428766 (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.
-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); } |