diff options
author | nikkolasg <nikkolasg@gmail.com> | 2016-06-17 10:41:45 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-06-20 08:44:58 -0400 |
commit | 568dc27a1943305f6e11a9a497f56a6aabe27c99 (patch) | |
tree | 0768e827b287c2d07f1b7e84342d21af48dcf353 /src/or/entrynodes.c | |
parent | 48b25e6811bb822542ea898e30aebc75e185f29d (diff) | |
download | tor-568dc27a1943305f6e11a9a497f56a6aabe27c99.tar.gz tor-568dc27a1943305f6e11a9a497f56a6aabe27c99.zip |
Make base16_decodes return number of decoded bytes
base16_decodes() now returns the number of decoded bytes. It's interface
changes from returning a "int" to a "ssize_t". Every callsite now checks the
returned value.
Fixes #14013
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r-- | src/or/entrynodes.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 1a31aa4822..bd64dc4421 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -1253,7 +1253,7 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg) } else { strlcpy(node->nickname, smartlist_get(args,0), MAX_NICKNAME_LEN+1); if (base16_decode(node->identity, DIGEST_LEN, smartlist_get(args,1), - strlen(smartlist_get(args,1)))<0) { + strlen(smartlist_get(args,1))) != DIGEST_LEN) { *msg = tor_strdup("Unable to parse entry nodes: " "Bad hex digest for EntryGuard"); } @@ -1309,8 +1309,9 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg) log_warn(LD_BUG, "EntryGuardAddedBy line is not long enough."); continue; } - if (base16_decode(d, sizeof(d), line->value, HEX_DIGEST_LEN)<0 || - line->value[HEX_DIGEST_LEN] != ' ') { + if (base16_decode(d, sizeof(d), + line->value, HEX_DIGEST_LEN) != sizeof(d) || + line->value[HEX_DIGEST_LEN] != ' ') { log_warn(LD_BUG, "EntryGuardAddedBy line %s does not begin with " "hex digest", escaped(line->value)); continue; |