summaryrefslogtreecommitdiffstats
path: root/nhrpd
diff options
context:
space:
mode:
authorJorge Boncompte <jbonor@gmail.com>2017-08-11 12:19:23 +0200
committerJorge Boncompte <jbonor@gmail.com>2017-08-11 12:19:23 +0200
commit6b07f6e1e8bcb2aa7424784a86328d0658513aea (patch)
treee2b0db76f84628862803a380c37864c63e2d3815 /nhrpd
parentnhrpd: fix issues found by coverity (diff)
downloadfrr-6b07f6e1e8bcb2aa7424784a86328d0658513aea.tar.xz
frr-6b07f6e1e8bcb2aa7424784a86328d0658513aea.zip
nhrpd: fixes for clang scan-build issues
Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
Diffstat (limited to 'nhrpd')
-rw-r--r--nhrpd/vici.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/nhrpd/vici.c b/nhrpd/vici.c
index a6d835562..fd01a4534 100644
--- a/nhrpd/vici.c
+++ b/nhrpd/vici.c
@@ -27,13 +27,13 @@ struct blob {
static int blob_equal(const struct blob *b, const char *str)
{
- if (b->len != (int) strlen(str)) return 0;
+ if (!b || b->len != (int) strlen(str)) return 0;
return memcmp(b->ptr, str, b->len) == 0;
}
static int blob2buf(const struct blob *b, char *buf, size_t n)
{
- if (b->len >= (int) n) return 0;
+ if (!b || b->len >= (int) n) return 0;
memcpy(buf, b->ptr, b->len);
buf[b->len] = 0;
return 1;
@@ -82,8 +82,8 @@ static void vici_parse_message(
struct vici_message_ctx *ctx)
{
uint8_t *type;
- struct blob key;
- struct blob val;
+ struct blob key = { 0 };
+ struct blob val = { 0 };
while ((type = zbuf_may_pull(msg, uint8_t)) != NULL) {
switch (*type) {
@@ -178,6 +178,9 @@ static void parse_sa_message(
}
break;
default:
+ if (!key)
+ break;
+
switch (key->ptr[0]) {
case 'l':
if (blob_equal(key, "local-host") && ctx->nsections == 1) {