https://issues.apache.org/bugzilla/show_bug.cgi?id=49634

           Summary: Possible segfault in core/server.c
           Product: Apache httpd-2
           Version: 2.3-HEAD
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Hi all,

I am a contributor to the open source project Clang, which functions as a C
front-end and static analyzer for the LLVM compiler. You can read more about it
at http://clang.llvm.org. I am currently writing some static analysis checks,
and one check has flagged a possible segfault and unreachable code in
core/server.c.

The function in question is dirsection (line 1785 in trunk).

1805:    arg = apr_pstrndup(cmd->pool, arg, endp - arg);
1806:
1807:    if (!arg[0]) {
1808:        return missing_container_arg(cmd);
1809:    }
1810:
1811:    if (!arg) {
1812:        if (thiscmd->cmd_data)
1813:            return "<DirectoryMatch > block must specify a path";
1814:        else
1815:            return "<Directory > block must specify a path";
1816:    }

The analyzer flags lines 1812-1815 as unreachable. We can see that on line
1807, arg is dereferenced without a null check. At line 1811, arg cannot be
null, so the condition is never satisfied. It seems that the author intended
the checks to be in the reverse order.

Tom

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to