Changeset 1944

Show
Ignore:
Timestamp:
08/18/2007 09:44:08 AM (14 months ago)
Author:
jan
Message:

fixed possible overflow in unix-socket path checks on BSD (#713)

- use sizeof(sun_path) instead of UNIX_PATH_MAX which might not be

defined

Location:
branches/lighttpd-1.4.x
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-1.4.x/NEWS

    r1942 r1944  
    1717  * fixed endless loop on shrinked files with sendfile() on BSD (#1289) 
    1818  * fixed counter overrun in ?auto in mod_status (#909) 
    19   * fixed too aggresive caching of nested conditionals  
     19  * fixed too aggresive caching of nested conditionals (#41) 
     20  * fixed possible overflow in unix-socket path checks on BSD (#713) 
    2021  * removed config-check if passwd files exist (#1188) 
    2122   
  • branches/lighttpd-1.4.x/src/mod_fastcgi.c

    r1882 r1944  
    4242 
    4343#include "sys-socket.h" 
    44  
    45  
    46 #ifndef UNIX_PATH_MAX 
    47 # define UNIX_PATH_MAX 108 
    48 #endif 
    4944 
    5045#ifdef HAVE_SYS_UIO_H 
     
    12551250                                        if (!buffer_is_empty(host->unixsocket)) { 
    12561251                                                /* unix domain socket */ 
    1257  
    1258                                                 if (host->unixsocket->used > UNIX_PATH_MAX - 2) { 
     1252                                                struct sockaddr_un un; 
     1253 
     1254                                                if (host->unixsocket->used > sizeof(un.sun_path) - 2) { 
    12591255                                                        log_error_write(srv, __FILE__, __LINE__, "sbsbsbs", 
    12601256                                                                        "unixsocket is too long in:", 
  • branches/lighttpd-1.4.x/src/mod_scgi.c

    r1882 r1944  
    3131 
    3232#include "sys-socket.h" 
    33  
    34  
    35 #ifndef UNIX_PATH_MAX 
    36 # define UNIX_PATH_MAX 108 
    37 #endif 
    3833 
    3934#ifdef HAVE_SYS_UIO_H 
     
    10281023                                        if (!buffer_is_empty(df->unixsocket)) { 
    10291024                                                /* unix domain socket */ 
    1030  
    1031                                                 if (df->unixsocket->used > UNIX_PATH_MAX - 2) { 
     1025                                                struct sockaddr_un un; 
     1026 
     1027                                                if (df->unixsocket->used > sizeof(un.sun_path) - 2) { 
    10321028                                                        log_error_write(srv, __FILE__, __LINE__, "s", 
    10331029                                                                        "path of the unixdomain socket is too large"); 
  • branches/lighttpd-1.4.x/src/spawn-fcgi.c

    r1872 r1944  
    2525 
    2626#define FCGI_LISTENSOCK_FILENO 0 
    27  
    28 #ifndef UNIX_PATH_MAX 
    29 # define UNIX_PATH_MAX 108 
    30 #endif 
    3127 
    3228#include "sys-socket.h" 
     
    274270        int pid_fd = -1; 
    275271        int nofork = 0; 
     272        struct sockaddr_un un; 
     273        const size_t sun_path_len = sizeof(un.sun_path); 
    276274 
    277275        i_am_root = (getuid() == 0); 
     
    310308        } 
    311309 
    312         if (unixsocket && strlen(unixsocket) > UNIX_PATH_MAX - 1) { 
     310        if (unixsocket && strlen(unixsocket) > sun_path_len - 1) { 
    313311                fprintf(stderr, "%s.%d: %s\n", 
    314312                        __FILE__, __LINE__,