aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/buffers.c4
-rw-r--r--src/or/eventdns.c10
-rw-r--r--src/or/rephist.c5
3 files changed, 12 insertions, 7 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 7a5fa6e946..a5732253be 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -998,7 +998,7 @@ move_buf_to_buf(buf_t *buf_out, buf_t *buf_in, size_t *buf_flushlen)
/** Internal structure: represents a position in a buffer. */
typedef struct buf_pos_t {
const chunk_t *chunk; /**< Which chunk are we pointing to? */
- off_t pos;/**< Which character inside the chunk's data are we pointing to? */
+ int pos;/**< Which character inside the chunk's data are we pointing to? */
size_t chunk_pos; /**< Total length of all previous chunks. */
} buf_pos_t;
@@ -1037,7 +1037,7 @@ buf_find_pos_of_char(char ch, buf_pos_t *out)
}
pos = out->pos;
for (chunk = out->chunk; chunk; chunk = chunk->next) {
- char *cp = memchr(chunk->data+pos, ch, chunk->datalen-pos);
+ char *cp = memchr(chunk->data+pos, ch, chunk->datalen - pos);
if (cp) {
out->chunk = chunk;
out->pos = cp - chunk->data;
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);
diff --git a/src/or/rephist.c b/src/or/rephist.c
index f431c81228..c7d44743e0 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -361,8 +361,9 @@ rep_hist_downrate_old_runs(time_t now)
(unsigned long)(hist->weighted_run_length * alpha);
hist->total_run_weights *= alpha;
- hist->weighted_uptime *= alpha;
- hist->total_weighted_time *= alpha;
+ hist->weighted_uptime = (unsigned long)(hist->weighted_uptime * alpha);
+ hist->total_weighted_time = (unsigned long)
+ (hist->total_weighted_time * alpha);
}
return stability_last_downrated + STABILITY_INTERVAL;