Skip to content

Commit 8cc9cce

Browse files
azatBrendanCunningham
authored andcommitted
Cherry-pick libevent CVE fixes from libevent into ompi. Fixes #10542.
CVE: https://nvd.nist.gov/vuln/detail/CVE-2016-10195 libevent issue: libevent dns remote stack overread vulnerability libevent/libevent#317 libevent fixing commit: libevent/libevent@96f64a0 CVE: https://nvd.nist.gov/vuln/detail/CVE-2016-10196 libevent issue: libevent (stack) buffer overflow in evutil_parse_sockaddr_port() libevent/libevent#318 libevent fixing commit: libevent/libevent@329acc1 CVE: https://nvd.nist.gov/vuln/detail/CVE-2016-10197 libevent issue: out-of-bounds read in search_make_new() libevent/libevent#332 libevent fixing commit: libevent/libevent@ec65c42 Signed-off-by: Brendan Cunningham <[email protected]>
1 parent 4fdd439 commit 8cc9cce

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

opal/mca/event/libevent2022/libevent/evdns.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,6 @@ name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
958958

959959
for (;;) {
960960
u8 label_len;
961-
if (j >= length) return -1;
962961
GET8(label_len);
963962
if (!label_len) break;
964963
if (label_len & 0xc0) {
@@ -979,6 +978,7 @@ name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
979978
*cp++ = '.';
980979
}
981980
if (cp + label_len >= end) return -1;
981+
if (j + label_len > length) return -1;
982982
memcpy(cp, packet + j, label_len);
983983
cp += label_len;
984984
j += label_len;
@@ -3120,9 +3120,12 @@ search_set_from_hostname(struct evdns_base *base) {
31203120
static char *
31213121
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
31223122
const size_t base_len = strlen(base_name);
3123-
const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
3123+
char need_to_append_dot;
31243124
struct search_domain *dom;
31253125

3126+
if (!base_len) return NULL;
3127+
need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
3128+
31263129
for (dom = state->head; dom; dom = dom->next) {
31273130
if (!n--) {
31283131
/* this is the postfix we want */

opal/mca/event/libevent2022/libevent/evutil.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,12 +1808,12 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *
18081808

18091809
cp = strchr(ip_as_string, ':');
18101810
if (*ip_as_string == '[') {
1811-
int len;
1811+
size_t len;
18121812
if (!(cp = strchr(ip_as_string, ']'))) {
18131813
return -1;
18141814
}
1815-
len = (int) ( cp-(ip_as_string + 1) );
1816-
if (len > (int)sizeof(buf)-1) {
1815+
len = ( cp-(ip_as_string + 1) );
1816+
if (len > sizeof(buf)-1) {
18171817
return -1;
18181818
}
18191819
memcpy(buf, ip_as_string+1, len);

0 commit comments

Comments
 (0)