You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/09/19 20:04:47 UTC

svn commit: r1172732 - in /httpd/httpd/trunk: modules/metadata/mod_headers.c modules/metadata/mod_mime_magic.c os/win32/util_win32.c

Author: sf
Date: Mon Sep 19 18:04:47 2011
New Revision: 1172732

URL: http://svn.apache.org/viewvc?rev=1172732&view=rev
Log:
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

Modified:
    httpd/httpd/trunk/modules/metadata/mod_headers.c
    httpd/httpd/trunk/modules/metadata/mod_mime_magic.c
    httpd/httpd/trunk/os/win32/util_win32.c

Modified: httpd/httpd/trunk/modules/metadata/mod_headers.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_headers.c?rev=1172732&r1=1172731&r2=1172732&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_headers.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_headers.c Mon Sep 19 18:04:47 2011
@@ -332,7 +332,7 @@ static char *parse_format_tag(apr_pool_t
         return NULL;
     }
 
-    tag->arg = '\0';
+    tag->arg = "\0";
     /* grab the argument if there is one */
     if (*s == '{') {
         ++s;

Modified: httpd/httpd/trunk/modules/metadata/mod_mime_magic.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_mime_magic.c?rev=1172732&r1=1172731&r2=1172732&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_mime_magic.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_mime_magic.c Mon Sep 19 18:04:47 2011
@@ -673,6 +673,7 @@ static int magic_rsl_to_request(request_
         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_
     }
 
     /* 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

Modified: httpd/httpd/trunk/os/win32/util_win32.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/os/win32/util_win32.c?rev=1172732&r1=1172731&r2=1172732&view=diff
==============================================================================
--- httpd/httpd/trunk/os/win32/util_win32.c (original)
+++ httpd/httpd/trunk/os/win32/util_win32.c Mon Sep 19 18:04:47 2011
@@ -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;