From: Stefan Fritsch Date: Mon, 19 Sep 2011 18:04:47 +0000 (+0000) Subject: Fix issues found by PVS-Studio static analyzer: X-Git-Tag: 2.3.15~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62441a77e496580609c0b0e643e0f80e2543abee;p=thirdparty%2Fapache%2Fhttpd.git 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 , Stefan Fritsch git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1172732 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c index b82281ea0c6..961d26aae25 100644 --- a/modules/metadata/mod_headers.c +++ b/modules/metadata/mod_headers.c @@ -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; diff --git a/modules/metadata/mod_mime_magic.c b/modules/metadata/mod_mime_magic.c index 7d17ede3370..3e99b11ae69 100644 --- a/modules/metadata/mod_mime_magic.c +++ b/modules/metadata/mod_mime_magic.c @@ -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); - } + 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 diff --git a/os/win32/util_win32.c b/os/win32/util_win32.c index 3a4038a5d01..86bd419f9fe 100644 --- a/os/win32/util_win32.c +++ b/os/win32/util_win32.c @@ -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;