summaryrefslogtreecommitdiff
path: root/src/htszlib.c
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-05-02 15:13:29 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-05-02 15:13:29 +0000
commit5544f503bf0fcfd050b4e338e8ec7b22e2f53b9a (patch)
tree2d65f1fd285c450cbb1c676697ad13b5a47a835c /src/htszlib.c
parentb3fa8537c411e6e2d53044b1d5d20c361d2ad17d (diff)
Big cleanup in functions writing to a char buffer without proper size boundary.
Diffstat (limited to 'src/htszlib.c')
-rw-r--r--src/htszlib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/htszlib.c b/src/htszlib.c
index e184e27..5042910 100644
--- a/src/htszlib.c
+++ b/src/htszlib.c
@@ -57,13 +57,13 @@ int hts_zunpack(char *filename, char *newfile) {
if (filename != NULL && newfile != NULL) {
if (filename[0] && newfile[0]) {
char catbuff[CATBUFF_SIZE];
- FILE *const in = FOPEN(fconv(catbuff, filename), "rb");
+ FILE *const in = FOPEN(fconv(catbuff, sizeof(catbuff), filename), "rb");
const int fd = in != NULL ? fileno(in) : -1;
// Note: we must dup to be able to flose cleanly.
gzFile gz = fd != -1 ? gzdopen(dup(fd), "rb") : NULL;
if (gz) {
- FILE *const fpout = FOPEN(fconv(catbuff, newfile), "wb");
+ FILE *const fpout = FOPEN(fconv(catbuff, sizeof(catbuff), newfile), "wb");
int size = 0;
if (fpout) {
@@ -95,8 +95,8 @@ int hts_zunpack(char *filename, char *newfile) {
int hts_extract_meta(const char *path) {
char catbuff[CATBUFF_SIZE];
- unzFile zFile = unzOpen(fconcat(catbuff, path, "hts-cache/new.zip"));
- zipFile zFileOut = zipOpen(fconcat(catbuff, path, "hts-cache/meta.zip"), 0);
+ unzFile zFile = unzOpen(fconcat(catbuff, sizeof(catbuff), path, "hts-cache/new.zip"));
+ zipFile zFileOut = zipOpen(fconcat(catbuff, sizeof(catbuff), path, "hts-cache/meta.zip"), 0);
if (zFile != NULL && zFileOut != NULL) {
if (unzGoToFirstFile(zFile) == Z_OK) {