diff options
-rw-r--r-- | src/common/container.c | 8 | ||||
-rw-r--r-- | src/or/config.c | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/common/container.c b/src/common/container.c index b138c9273c..8e507486c8 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -89,10 +89,12 @@ smartlist_add(smartlist_t *sl, void *element) void smartlist_add_all(smartlist_t *s1, const smartlist_t *s2) { - smartlist_ensure_capacity(s1, s1->num_used + s2->num_used); - tor_assert(s1->capacity >= s1->num_used+s2->num_used); + int new_size = s1->num_used + s2->num_used; + tor_assert(new_size >= s1->num_used); /* check for overflow. */ + smartlist_ensure_capacity(s1, new_size); + tor_assert(s1->capacity >= new_size); memcpy(s1->list + s1->num_used, s2->list, s2->num_used*sizeof(void*)); - s1->num_used += s2->num_used; + s1->num_used = new_size; } /** Remove all elements E from sl such that E==element. Preserve diff --git a/src/or/config.c b/src/or/config.c index b838eadc3e..75e88bfe3a 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -4754,7 +4754,7 @@ or_state_load(void) "to \"%s\". This could be a bug in Tor; please tell " "the developers.", fname, fname2); if (rename(fname, fname2) < 0) { - log_warn(LD_BUG, "Weirdly, I couldn't even mode the state aside. The " + log_warn(LD_BUG, "Weirdly, I couldn't even move the state aside. The " "OS gave an error of %s", strerror(errno)); } } |