Skip to content

Commit af65982

Browse files
committed
1 parent c655ea8 commit af65982

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

  • TMessagesProj/jni/voip/webrtc

TMessagesProj/jni/voip/webrtc/base/third_party/libevent/evdns.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
804804
*cp++ = '.';
805805
}
806806
if (cp + label_len >= end) return -1;
807+
if (j + label_len > length) return -1;
807808
memcpy(cp, packet + j, label_len);
808809
cp += label_len;
809810
j += label_len;
@@ -2496,9 +2497,12 @@ search_set_from_hostname(void) {
24962497
static char *
24972498
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
24982499
const int base_len = strlen(base_name);
2499-
const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
2500+
char need_to_append_dot;
25002501
struct search_domain *dom;
25012502

2503+
if (!base_len) return NULL;
2504+
need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
2505+
25022506
for (dom = state->head; dom; dom = dom->next) {
25032507
if (!n--) {
25042508
/* this is the postfix we want */

TMessagesProj/jni/voip/webrtc/third_party/libevent/evdns.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
804804
*cp++ = '.';
805805
}
806806
if (cp + label_len >= end) return -1;
807+
if (j + label_len > length) return -1;
807808
memcpy(cp, packet + j, label_len);
808809
cp += label_len;
809810
j += label_len;
@@ -2496,9 +2497,12 @@ search_set_from_hostname(void) {
24962497
static char *
24972498
search_make_new(const struct search_state *const state, int n, const char *const base_name) {
24982499
const int base_len = strlen(base_name);
2499-
const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
2500+
char need_to_append_dot;
25002501
struct search_domain *dom;
25012502

2503+
if (!base_len) return NULL;
2504+
need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
2505+
25022506
for (dom = state->head; dom; dom = dom->next) {
25032507
if (!n--) {
25042508
/* this is the postfix we want */

0 commit comments

Comments
 (0)