diff options
| author | Toomas Soome <tsoome@me.com> | 2019-12-13 10:00:19 +0200 |
|---|---|---|
| committer | Toomas Soome <tsoome@me.com> | 2019-12-16 18:48:39 +0200 |
| commit | e58ba7f235f59e7b79c7d4ce4fb02b7adc47273e (patch) | |
| tree | 8e8945f38b00c9fa8f1949fd4edddda2a3908e5b /usr/src/boot/lib/libstand | |
| parent | 8047359fa9aaaf6af13c81ce125afa018449661d (diff) | |
| download | illumos-joyent-e58ba7f235f59e7b79c7d4ce4fb02b7adc47273e.tar.gz | |
12074 loader: cd9660_open() warn: is 'buf' large enough for 'struct iso_primary_descriptor'?
Reviewed by: John Levon <john.levon@joyent.com>
Reviewed by: C Fraire <cfraire@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/boot/lib/libstand')
| -rw-r--r-- | usr/src/boot/lib/libstand/cd9660.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr/src/boot/lib/libstand/cd9660.c b/usr/src/boot/lib/libstand/cd9660.c index 487b994408..a17146fce5 100644 --- a/usr/src/boot/lib/libstand/cd9660.c +++ b/usr/src/boot/lib/libstand/cd9660.c @@ -286,7 +286,7 @@ cd9660_open(const char *path, struct open_file *f) struct file *fp = NULL; void *buf; struct iso_primary_descriptor *vd; - size_t buf_size, read, dsize, off; + size_t read, dsize, off; daddr_t bno, boff; struct iso_directory_record rec; struct iso_directory_record *dp = NULL; @@ -294,7 +294,8 @@ cd9660_open(const char *path, struct open_file *f) bool isdir = false; /* First find the volume descriptor */ - buf = malloc(buf_size = ISO_DEFAULT_BLOCK_SIZE); + buf = malloc(MAX(ISO_DEFAULT_BLOCK_SIZE, + sizeof (struct iso_primary_descriptor))); vd = buf; for (bno = 16; ; bno++) { twiddle(1); @@ -438,8 +439,7 @@ cd9660_open(const char *path, struct open_file *f) return (0); out: - if (fp) - free(fp); + free(fp); free(buf); return (rc); |
