]> granicus.if.org Git - apache/commitdiff
Fix issues found by PVS-Studio static analyzer:
authorStefan Fritsch <sf@apache.org>
Mon, 19 Sep 2011 18:04:47 +0000 (18:04 +0000)
committerStefan Fritsch <sf@apache.org>
Mon, 19 Sep 2011 18:04:47 +0000 (18:04 +0000)
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

modules/metadata/mod_headers.c
modules/metadata/mod_mime_magic.c
os/win32/util_win32.c

index b82281ea0c6adf086a5f752c6e15e6c358cc078c..961d26aae257190133799c2cdb8ee0099894be44 100644 (file)
@@ -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;
index 7d17ede3370f511cedb5603ef49cb34ba0239104..3e99b11ae69fe3a794b797ea2c843bd8fde3383e 100644 (file)
@@ -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
index 3a4038a5d019fff8f2895753af5c605cb8fa756c..86bd419f9fe011a750434569964673b9bc4ad981 100644 (file)
@@ -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;