diff options
author | gordon <gordon@FreeBSD.org> | 2018-03-07 06:04:25 +0000 |
---|---|---|
committer | gordon <gordon@FreeBSD.org> | 2018-03-07 06:04:25 +0000 |
commit | c69c8ae8053b66933da68a1f410f78dda1300dd7 (patch) | |
tree | 112e12ebf327447d4aa0325a38185a75f10947c9 /contrib/file/src/funcs.c | |
parent | f759173fe55c14d92140754fc86200fc2b101b06 (diff) | |
download | FreeBSD-src-c69c8ae8053b66933da68a1f410f78dda1300dd7.zip FreeBSD-src-c69c8ae8053b66933da68a1f410f78dda1300dd7.tar.gz |
Update file(1) to new version with security update. [EN-18:02.file]
Approved by: so
Security: FreeBSD-EN-18:02.file
Security: CVE-2017-1000249
Diffstat (limited to 'contrib/file/src/funcs.c')
-rw-r--r-- | contrib/file/src/funcs.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/file/src/funcs.c b/contrib/file/src/funcs.c index c8918a4..d7a18f4 100644 --- a/contrib/file/src/funcs.c +++ b/contrib/file/src/funcs.c @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.90 2016/10/19 20:51:17 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.93 2017/08/28 13:39:18 christos Exp $") #endif /* lint */ #include "magic.h" @@ -76,7 +76,7 @@ file_vprintf(struct magic_set *ms, const char *fmt, va_list ap) ms->o.buf = buf; return 0; out: - file_error(ms, errno, "vasprintf failed"); + fprintf(stderr, "vasprintf failed (%s)", strerror(errno)); return -1; } @@ -328,9 +328,9 @@ simple: #endif protected int -file_reset(struct magic_set *ms) +file_reset(struct magic_set *ms, int checkloaded) { - if (ms->mlist[0] == NULL) { + if (checkloaded && ms->mlist[0] == NULL) { file_error(ms, 0, "no magic files loaded"); return -1; } @@ -509,6 +509,8 @@ file_regexec(file_regex_t *rx, const char *str, size_t nmatch, regmatch_t* pmatch, int eflags) { assert(rx->rc == 0); + /* XXX: force initialization because glibc does not always do this */ + memset(pmatch, 0, nmatch * sizeof(*pmatch)); return regexec(&rx->rx, str, nmatch, pmatch, eflags); } |