Commit 0607dca4 authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

Fix issues found by PVS-Studio static analyzer:

mod_mime_magic:
cut'n'paste error rsl_encoding vs. rsl_separator, also simplify code a bit

mod_header:
wrong string initialization (leading to segfault if format argument is missing)

util_win32: duplicate sizeof (untested; Windows people, please review)

PR: 51542
Submitted by: Andrey Karpov <karpov viva64 com>, Stefan Fritsch


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1172732 13f79535-47bb-0310-9956-ffa450edef68
parent 8a4f138c
Loading
Loading
Loading
Loading
+1 −1
Changes for modules/metadata/mod_headers.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -332,7 +332,7 @@ static char *parse_format_tag(apr_pool_t *p, format_tag *tag, const char **sa)
        return NULL;
    }

    tag->arg = '\0';
    tag->arg = "\0";
    /* grab the argument if there is one */
    if (*s == '{') {
        ++s;
+2 −5
Changes for modules/metadata/mod_mime_magic.c: 2 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -673,6 +673,7 @@ static int magic_rsl_to_request(request_rec *r)
        encoding_pos,     /* content encoding starting point: position */
        encoding_len;     /* content encoding length */

    char *tmp;
    magic_rsl *frag;      /* list-traversal pointer */
    rsl_states state;

@@ -784,17 +785,13 @@ static int magic_rsl_to_request(request_rec *r)
    }

    /* save the info in the request record */
    if (state == rsl_subtype || state == rsl_encoding ||
        state == rsl_encoding) {
        char *tmp;
    tmp = rsl_strdup(r, type_frag, type_pos, type_len);
    /* XXX: this could be done at config time I'm sure... but I'm
     * confused by all this magic_rsl stuff. -djg */
    ap_content_type_tolower(tmp);
    ap_set_content_type(r, tmp);
    }

    if (state == rsl_encoding) {
        char *tmp;
        tmp = rsl_strdup(r, encoding_frag,
                                         encoding_pos, encoding_len);
        /* XXX: this could be done at config time I'm sure... but I'm
+1 −1
Changes for os/win32/util_win32.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ PSECURITY_ATTRIBUTES GetNullACL(void)
    PSECURITY_ATTRIBUTES sa;

    sa  = (PSECURITY_ATTRIBUTES) LocalAlloc(LPTR, sizeof(SECURITY_ATTRIBUTES));
    sa->nLength = sizeof(sizeof(SECURITY_ATTRIBUTES));
    sa->nLength = sizeof(SECURITY_ATTRIBUTES);

    pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
    sa->lpSecurityDescriptor = pSD;