summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2018-06-21 14:18:47 -0400
committerGitHub <noreply@github.com>2018-06-21 14:18:47 -0400
commit1337a02851f3b24b56e300f9db49615ed6485b31 (patch)
tree276643c9f5a489faaf515add0672cc3479fbfb7d
parentcc05c430b380b01f7396013e9d1bc13321eb8601 (diff)
parentd1f92e454c24a4ac96d930ae35f0fa38cc8e60f6 (diff)
Merge pull request #2522 from pacovn/Coverity_1399277_Explicit_null_dereferenced
lib: null check (Coverity 1399277)
-rw-r--r--lib/sockunion.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sockunion.c b/lib/sockunion.c
index 28a7f647cb..44378b5363 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -46,6 +46,9 @@ int str2sockunion(const char *str, union sockunion *su)
{
int ret;
+ if (str == NULL)
+ return -1;
+
memset(su, 0, sizeof(union sockunion));
ret = inet_pton(AF_INET, str, &su->sin.sin_addr);