diff options
author | jobol@nonadev.net <jobol@nonadev.net> | 2017-05-05 10:07:18 +0200 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-05-23 15:49:34 +0200 |
commit | 5acb6e9aeae6a6ee35c2f889c4e9fefedb931f1f (patch) | |
tree | 0cae167b4bc0365fc1be25c0037213f17975d27e | |
parent | a978ea30514307b565512817ff47d8d25cb10ff7 (diff) | |
download | meta-openembedded-5acb6e9aeae6a6ee35c2f889c4e9fefedb931f1f.tar.gz |
libmicrohttpd: Fix a segmentation fault on upgrade error
When a connection upgrade is requested and when the
request sent an error reply, it happened most often
that a segmentation fault occured.
The patch applied here is a backport from the
upstream (see https://gnunet.org/git/libmicrohttpd.git/
commit b4216c60fdb5b48f6cfec416301fc63a1167e6cd).
Change-Id: I6847550ba2c4fc24d5caf8912ac6d5ac89ae01fb
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r-- | meta-oe/recipes-support/libmicrohttpd/libmicrohttpd/Check-response-existence-on-upgrade.patch | 49 | ||||
-rw-r--r-- | meta-oe/recipes-support/libmicrohttpd/libmicrohttpd_0.9.53.bb | 3 |
2 files changed, 52 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libmicrohttpd/libmicrohttpd/Check-response-existence-on-upgrade.patch b/meta-oe/recipes-support/libmicrohttpd/libmicrohttpd/Check-response-existence-on-upgrade.patch new file mode 100644 index 000000000..a02bbd4d0 --- /dev/null +++ b/meta-oe/recipes-support/libmicrohttpd/libmicrohttpd/Check-response-existence-on-upgrade.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From: jose.bollo@iot.bzh | ||
2 | Date: Thu, 4 May 2017 21:47:38 +0200 | ||
3 | Subject: [PATCH] Check response existence on upgrade | ||
4 | MIME-Version: 1.0 | ||
5 | Content-Type: text/plain; charset=UTF-8 | ||
6 | Content-Transfer-Encoding: 8bit | ||
7 | |||
8 | When a connection upgrade is requested and when the | ||
9 | request sent an error reply, the response is most of | ||
10 | the time already sent when the test on | ||
11 | connection->response->upgrade_handler is made, leading | ||
12 | to dereferencing NULL. | ||
13 | |||
14 | Two possibilities exist: | ||
15 | |||
16 | NULL == connection->response || NULL == connection->response->upgrade_handler | ||
17 | |||
18 | or | ||
19 | |||
20 | NULL != connection->response && NULL == connection->response->upgrade_handler | ||
21 | |||
22 | The first is prefered because it is probably safer to close the connection | ||
23 | in that case. | ||
24 | |||
25 | Upstream-Status: Accepted [https://gnunet.org/git/libmicrohttpd.git/commit/?id=b4216c60fdb5b48f6cfec416301fc63a1167e6cd] | ||
26 | |||
27 | Change-Id: Ie6e7fc165f7fe3635ade0952bb34a0b937d38716 | ||
28 | Signed-off-by: José Bollo <jobol@nonadev.net> | ||
29 | Signed-off-by: José Bollo <jose.bollo@iot.bzh> | ||
30 | --- | ||
31 | src/microhttpd/connection.c | 2 +- | ||
32 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
33 | |||
34 | diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c | ||
35 | index a495524..d39c110 100644 | ||
36 | --- a/src/microhttpd/connection.c | ||
37 | +++ b/src/microhttpd/connection.c | ||
38 | @@ -882,7 +882,7 @@ keepalive_possible (struct MHD_Connection *connection) | ||
39 | #ifdef UPGRADE_SUPPORT | ||
40 | if ( (MHD_str_equal_caseless_ (end, | ||
41 | "upgrade")) && | ||
42 | - (NULL == connection->response->upgrade_handler) ) | ||
43 | + (NULL == connection->response || NULL == connection->response->upgrade_handler) ) | ||
44 | return MHD_NO; | ||
45 | #endif /* UPGRADE_SUPPORT */ | ||
46 | |||
47 | -- | ||
48 | 2.9.3 | ||
49 | |||
diff --git a/meta-oe/recipes-support/libmicrohttpd/libmicrohttpd_0.9.53.bb b/meta-oe/recipes-support/libmicrohttpd/libmicrohttpd_0.9.53.bb index a7f032ab5..45f2460d0 100644 --- a/meta-oe/recipes-support/libmicrohttpd/libmicrohttpd_0.9.53.bb +++ b/meta-oe/recipes-support/libmicrohttpd/libmicrohttpd_0.9.53.bb | |||
@@ -9,6 +9,9 @@ SRC_URI = "http://ftp.gnu.org/gnu/libmicrohttpd/${BPN}-${PV}.tar.gz" | |||
9 | SRC_URI[md5sum] = "5a425e993a0f5295aecb5d6607a1c242" | 9 | SRC_URI[md5sum] = "5a425e993a0f5295aecb5d6607a1c242" |
10 | SRC_URI[sha256sum] = "9b15ec2d381f44936323adfd4f989fa35add517cccbbfa581896b02a393c2cc4" | 10 | SRC_URI[sha256sum] = "9b15ec2d381f44936323adfd4f989fa35add517cccbbfa581896b02a393c2cc4" |
11 | 11 | ||
12 | FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" | ||
13 | SRC_URI += " file://Check-response-existence-on-upgrade.patch" | ||
14 | |||
12 | inherit autotools lib_package pkgconfig gettext | 15 | inherit autotools lib_package pkgconfig gettext |
13 | 16 | ||
14 | EXTRA_OECONF += "--disable-static --with-gnutls=${STAGING_LIBDIR}/../" | 17 | EXTRA_OECONF += "--disable-static --with-gnutls=${STAGING_LIBDIR}/../" |