[Bug 954] New: libhylafax RE (regular expression) regcomp doesn't initialize value

[email protected] Wed, 18 Sep 2013 09:49:42 -0400
Newsgroups gmane.comp.telephony.fax.hylafax.devel
Message-ID <[email protected]/>
http://bugs.hylafax.org/show_bug.cgi?id=954

           Summary: libhylafax RE (regular expression) regcomp doesn't
                    initialize value
           Product: HylaFAX
           Version: latest
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: hfaxd
        AssignedTo: [email protected]
        ReportedBy: [email protected]


I found an issue in hylafax 6.0.6 when trying to cross compile code in an 64
bit machine for a 32 bit one.
I am using openembedded for cross compiling the toolchain and the code.

The issue is this: in HylaFAXServer::checkuserHosts(FILE* db, const char* name)
when trying to get user 
at line 182 if (pat.Find(dotform) || pat.Find(hostform))  the pat.Find call
never return true even when 
it found the right user.
I suppose that there is a bug somewhere in RE::init() and more precisely when
calling the regcomp(&c_pattern, _pattern, flags);
the field c_pattern.re_nsub isn't initialized to 0, so the code in the follow
mismatch this value and allocate much memory
(in my case call matches = new regmatch_t[c_pattern.re_nsub+1]; with re_nsub =
1140601674). I check the regcomp method, but 
inside the code before returning to caller the value of preg->re_nsub is
correctly set to 0. I suppose that there is some 
mistake in parameter passing on stack or elsewhere.
I fix this adding a bzero(&c_pattern, sizeof(c_pattern)) before call regcomp in
RE::init().

If you need I can give the dumpspecs and the dumpmachine of the cross compiler,
it is a gcc 4.7.2 ...


-- 
Configure bugmail: http://bugs.hylafax.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


____________________ HylaFAX(tm) Developers Mailing List ____________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe [email protected] < /dev/null