aboutsummaryrefslogtreecommitdiff
path: root/src/or/eventdns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/eventdns.c')
-rw-r--r--src/or/eventdns.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/eventdns.c b/src/or/eventdns.c
index 239bf9f801..75d1467d47 100644
--- a/src/or/eventdns.c
+++ b/src/or/eventdns.c
@@ -1298,8 +1298,12 @@ dnslabel_table_get_pos(const struct dnslabel_table *table, const char *label)
{
int i;
for (i = 0; i < table->n_labels; ++i) {
- if (!strcmp(label, table->labels[i].v))
- return table->labels[i].pos;
+ if (!strcmp(label, table->labels[i].v)) {
+ off_t pos = table->labels[i].pos;
+ if (pos > 65535)
+ return -1;
+ return (int)pos;
+ }
}
return -1;
}
@@ -1682,7 +1686,7 @@ overflow:
buf[3] |= 0x02; /* set the truncated bit. */
}
- req->response_len = j;
+ req->response_len = (size_t)j;
if (!(req->response = malloc(req->response_len))) {
server_request_free_answers(req);