diff --git a/src/funcs.c b/src/funcs.c index d39056b7..33778ff1 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -27,29 +27,29 @@ #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.92 2017/04/07 20:10:24 christos Exp $") #endif /* lint */ #include "magic.h" #include #include #include #include #include #if defined(HAVE_WCHAR_H) #include #endif #if defined(HAVE_WCTYPE_H) #include #endif #if defined(HAVE_LIMITS_H) #include #endif #ifndef SIZE_MAX #define SIZE_MAX ((size_t)~0) #endif /* * Like printf, only we append to a buffer. */ @@ -508,7 +508,9 @@ protected int 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); }