From: Christos Zoulas Date: Wed, 20 Apr 2016 00:00:26 +0000 (+0000) Subject: mention the bug here, and fix a debugging printf. X-Git-Tag: FILE5_27~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=753e9e288a66407c15e272ede3166ca3419aa647;p=file mention the bug here, and fix a debugging printf. --- diff --git a/src/compress.c b/src/compress.c index 2a95f85d..a3808996 100644 --- a/src/compress.c +++ b/src/compress.c @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: compress.c,v 1.94 2016/04/19 13:39:19 christos Exp $") +FILE_RCSID("@(#)$File: compress.c,v 1.95 2016/04/19 23:36:36 christos Exp $") #endif #include "magic.h" @@ -215,7 +215,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name, continue; nsz = nbytes; urv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz); - DPRINTF("uncompressbuf = %d, %s, %zu\n", rv, (char *)newbuf, + DPRINTF("uncompressbuf = %d, %s, %zu\n", urv, (char *)newbuf, nsz); switch (urv) { case OKDATA: @@ -239,6 +239,10 @@ file_zmagic(struct magic_set *ms, int fd, const char *name, goto error; if ((pb = file_push_buffer(ms)) == NULL) goto error; + /* + * XXX: If file_buffer fails here, we overwrite + * the compressed text. FIXME. + */ if (file_buffer(ms, -1, NULL, buf, nbytes) == -1) goto error; if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {