--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libevent/patches/CVE-2016-10195.patch Thu Feb 02 15:16:38 2017 -0800
@@ -0,0 +1,29 @@
+Fix for CVE-2016-10195
+
+More details at:
+
+ https://github.com/libevent/libevent/issues/317
+
+Based on commit at:
+
+ https://github.com/libevent/libevent/commit/96f64a022014a208105ead6c8a7066018449d86d
+
+--- libevent-2.0.22/evdns.c.orig 2017-02-02 07:18:16.307620386 +0000
++++ libevent-2.0.22/evdns.c 2017-02-02 07:23:36.432656559 +0000
+@@ -960,7 +960,6 @@
+
+ for (;;) {
+ u8 label_len;
+- if (j >= length) return -1;
+ GET8(label_len);
+ if (!label_len) break;
+ if (label_len & 0xc0) {
+@@ -980,7 +979,7 @@
+ if (cp + 1 >= end) return -1;
+ *cp++ = '.';
+ }
+- if (cp + label_len >= end) return -1;
++ if (j + label_len > length) return -1;
+ memcpy(cp, packet + j, label_len);
+ cp += label_len;
+ j += label_len;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libevent/patches/CVE-2016-10196.patch Thu Feb 02 15:16:38 2017 -0800
@@ -0,0 +1,28 @@
+Fix for CVE-2016-10196
+
+More details at:
+
+ https://github.com/libevent/libevent/issues/318
+
+Based on commit at:
+
+ https://github.com/libevent/libevent/commit/329acc18a0768c21ba22522f01a5c7f46cacc4d5
+
+--- libevent-2.0.22/evutil.c.orig 2017-02-02 07:20:55.460219824 +0000
++++ libevent-2.0.22/evutil.c 2017-02-02 07:25:18.285916416 +0000
+@@ -1808,12 +1808,12 @@
+
+ cp = strchr(ip_as_string, ':');
+ if (*ip_as_string == '[') {
+- int len;
++ size_t len;
+ if (!(cp = strchr(ip_as_string, ']'))) {
+ return -1;
+ }
+- len = (int) ( cp-(ip_as_string + 1) );
+- if (len > (int)sizeof(buf)-1) {
++ len = ( cp-(ip_as_string + 1) );
++ if (len > sizeof(buf)-1) {
+ return -1;
+ }
+ memcpy(buf, ip_as_string+1, len);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libevent/patches/CVE-2016-10197.patch Thu Feb 02 15:16:38 2017 -0800
@@ -0,0 +1,25 @@
+Fix for CVE-2016-10197
+
+More details at:
+
+ https://github.com/libevent/libevent/issues/332
+
+Based on commit at:
+
+ https://github.com/libevent/libevent/commit/ec65c42052d95d2c23d1d837136d1cf1d9ecef9e
+
+--- libevent-2.0.22/evdns.c.orig 2017-02-02 07:18:16.307620386 +0000
++++ libevent-2.0.22/evdns.c 2017-02-02 07:23:36.432656559 +0000
+@@ -3122,9 +3121,11 @@
+ static char *
+ search_make_new(const struct search_state *const state, int n, const char *const base_name) {
+ const size_t base_len = strlen(base_name);
+- const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
++ char need_to_append_dot;
+ struct search_domain *dom;
+
++ if (!base_len) return NULL;
++ need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
+ for (dom = state->head; dom; dom = dom->next) {
+ if (!n--) {
+ /* this is the postfix we want */