diff options
author | paco <paco@voltanet.io> | 2018-06-27 15:24:45 +0200 |
---|---|---|
committer | paco <paco@voltanet.io> | 2018-06-27 15:24:45 +0200 |
commit | 64268e1a12c0a07293a5db9fc65df4d5f3f926c5 (patch) | |
tree | f092cda07f4b384cf6bf95cb20a6da15e37f27cc /lib | |
parent | Merge pull request #2556 from pacovn/Coverity_1465491_Untrusted_value_as_argu... (diff) | |
download | frr-64268e1a12c0a07293a5db9fc65df4d5f3f926c5.tar.xz frr-64268e1a12c0a07293a5db9fc65df4d5f3f926c5.zip |
lib: null check (2) (Coverity 1451361)
Additional correction to fa3016309b33395c02cf10e7e198517c5b81e55a
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/command_match.c | 6 | ||||
-rw-r--r-- | lib/linklist.h | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/command_match.c b/lib/command_match.c index 4893ead04..c165305d7 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -608,12 +608,14 @@ static struct cmd_token *disambiguate_tokens(struct cmd_token *first, static struct list *disambiguate(struct list *first, struct list *second, vector vline, unsigned int n) { + assert(first != NULL); + assert(second != NULL); // doesn't make sense for these to be inequal length - assert(first && second); assert(first->count == second->count); assert(first->count == vector_active(vline) - n + 1); - struct listnode *fnode = listhead(first), *snode = listhead(second); + struct listnode *fnode = listhead_unchecked(first), + *snode = listhead_unchecked(second); struct cmd_token *ftok = listgetdata(fnode), *stok = listgetdata(snode), *best = NULL; diff --git a/lib/linklist.h b/lib/linklist.h index ea5a3531a..1e2631ea4 100644 --- a/lib/linklist.h +++ b/lib/linklist.h @@ -54,6 +54,7 @@ struct list { #define listnextnode(X) ((X) ? ((X)->next) : NULL) #define listnextnode_unchecked(X) ((X)->next) #define listhead(X) ((X) ? ((X)->head) : NULL) +#define listhead_unchecked(X) ((X)->head) #define listtail(X) ((X) ? ((X)->tail) : NULL) #define listcount(X) ((X)->count) #define list_isempty(X) ((X)->head == NULL && (X)->tail == NULL) |