Project

General

Profile

Bug #2766

crashes for invalid IP addresses when using mod_extforward

Added by Gilby 5 months ago. Updated 4 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_extforward
Target version:
Start date:
2016-11-06
Due date:
% Done:

100%

Missing in 1.5.x:

Description

lighttpd crashes when using mod_extforward from an invalid IP.

These two cases have shown in my error.log:
2016-11-01 08:13:01: (mod_extforward.c.330) could not parse ip address 78.253.43.53:50883 because hostname nor servname provided, or not known (Bad file descriptor)
2016-01-14 11:58:53: (mod_extforward.c.331) could not parse ip address 147.13.742.564 because hostname nor servname provided, or not known (Bad file descriptor)

And this shows in my /var/log/messages:
Nov 1 08:13:01 x kernel: pid 31758 (lighttpd), uid 80: exited on signal 11

Associated revisions

Revision bb30f445 (diff)
Added by gstrauss 4 months ago

[mod_extforward] fix crash on invalid IP (fixes #2766)

x-ref:
"crashes for invalid IP addresses when using mod_extforward"
https://redmine.lighttpd.net/issues/2766

History

#1 Updated by gstrauss 5 months ago

Please try this patch:

--- a/src/mod_extforward.c
+++ b/src/mod_extforward.c
@@ -423,6 +423,7 @@ URIHANDLER_FUNC(mod_extforward_uri_handler) {

        if (real_remote_addr != NULL) { /* parsed */
                sock_addr sock;
+               sock.plain.sa_family = AF_UNSPEC;
                data_string *forwarded_proto = (data_string *)array_get_element(con->request.headers, "X-Forwarded-Proto");

                if (NULL != forwarded_proto) {

#2 Updated by Gilby 4 months ago

Thanks, I applied that patch a few days ago and so far no issues.

#3 Updated by gstrauss 4 months ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Also available in: Atom