Skip to content

Commit

Permalink
Forbid pointless http_add_cookie() with value==NULL and !replace
Browse files Browse the repository at this point in the history
Coverity doesn't like it, because it would lead to dereferencing a NULL
pointer. It should never happen, since it's meaningless. So explicitly
return -EINVAL.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Feb 28, 2015
1 parent cb84498 commit 21918c3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions http.c
Expand Up @@ -308,6 +308,9 @@ int http_add_cookie(struct openconnect_info *vpninfo, const char *option,
} else {
/* Kill cookie; don't replace it */
new = NULL;
/* This would be meaningless */
if (!replace)
return -EINVAL;
}
for (this = &vpninfo->cookies; *this; this = &(*this)->next) {
if (!strcmp(option, (*this)->option)) {
Expand Down

0 comments on commit 21918c3

Please sign in to comment.