aboutsummaryrefslogtreecommitdiff
path: root/src/lib/pubsub
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-03-28 09:19:23 -0400
committerNick Mathewson <nickm@torproject.org>2019-03-28 09:19:23 -0400
commitf58587a68dec2cdbcbf3d3d46414c05fc9dfffbd (patch)
tree3480eddf1682bf3b14dcffe5ac4dc639397de1fa /src/lib/pubsub
parent00ca3d04cfa0625349a47d1a2f7c16ac66e7822d (diff)
downloadtor-f58587a68dec2cdbcbf3d3d46414c05fc9dfffbd.tar.gz
tor-f58587a68dec2cdbcbf3d3d46414c05fc9dfffbd.zip
Don't unconditionally deref pub and sub in lint_message_consistency
This can't actually result in a null pointer dereference, since pub_excl and sub_excl are only set when the corresponding smartlists are nonempty. But coverity isn't smart enough to figure that out, and we shouldn't really be depending on it. Bug 29938; CID 1444257. Bug not in any released Tor.
Diffstat (limited to 'src/lib/pubsub')
-rw-r--r--src/lib/pubsub/pubsub_check.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/pubsub/pubsub_check.c b/src/lib/pubsub/pubsub_check.c
index d308dc58aa..a3c22d4f25 100644
--- a/src/lib/pubsub/pubsub_check.c
+++ b/src/lib/pubsub/pubsub_check.c
@@ -303,14 +303,14 @@ lint_message_consistency(message_id_t msg,
/* Enforce exclusive-ness for publishers and subscribers that have asked for
* it.
*/
- if (pub_excl && smartlist_len(pub) > 1) {
+ if (pub_excl && smartlist_len_opt(pub) > 1) {
log_warn(LD_MESG|LD_BUG,
"Message \"%s\" has multiple publishers, but at least one is "
"marked as exclusive.",
get_message_id_name(msg));
ok = false;
}
- if (sub_excl && smartlist_len(sub) > 1) {
+ if (sub_excl && smartlist_len_opt(sub) > 1) {
log_warn(LD_MESG|LD_BUG,
"Message \"%s\" has multiple subscribers, but at least one is "
"marked as exclusive.",