diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-04-13 23:45:37 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-04-13 23:45:37 +0000 |
commit | 5c2c79eafdaffd172c20dd2cebc96f3dea266b96 (patch) | |
tree | 6b324c0c8fe5322b967c90baad9fbf3b820f985f /lib/libarchive/archive_read_open_file.c | |
parent | 2d52f8e62f64e1c72b250c97a58a6e324d6b62d4 (diff) | |
download | FreeBSD-src-5c2c79eafdaffd172c20dd2cebc96f3dea266b96.zip FreeBSD-src-5c2c79eafdaffd172c20dd2cebc96f3dea266b96.tar.gz |
* Plug a buffer overrun in ACL parsing. (archive_entry.c)
* Re-use a single buffer for shar output formatting rather
than hammering the heap. (archive_write_set_format_shar.c)
* Fix a handful of minor memory leaks and clean up some of the
memory-management code.
Diffstat (limited to 'lib/libarchive/archive_read_open_file.c')
-rw-r--r-- | lib/libarchive/archive_read_open_file.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libarchive/archive_read_open_file.c b/lib/libarchive/archive_read_open_file.c index f26a362..fa30bbb 100644 --- a/lib/libarchive/archive_read_open_file.c +++ b/lib/libarchive/archive_read_open_file.c @@ -68,7 +68,7 @@ archive_read_open_file(struct archive *a, const char *filename, strcpy(mine->filename, filename); } mine->block_size = block_size; - mine->buffer = malloc(mine->block_size); + mine->buffer = NULL; mine->fd = -1; return (archive_read_open(a, mine, file_open, file_read, file_close)); } @@ -78,6 +78,7 @@ file_open(struct archive *a, void *client_data) { struct read_file_data *mine = client_data; + mine->buffer = malloc(mine->block_size); if (*mine->filename != 0) mine->fd = open(mine->filename, O_RDONLY); else @@ -108,6 +109,8 @@ file_close(struct archive *a, void *client_data) (void)a; /* UNUSED */ if (mine->fd >= 0) close(mine->fd); + if (mine->buffer != NULL) + free(mine->buffer); free(mine); return (ARCHIVE_OK); } |