File 0005-nss.c-wrong-check-of-return-value.patch of Package nfsidmap

From e22368f6a6651e23d537f92ab5dec0ea37de8fa5 Mon Sep 17 00:00:00 2001
From: Steve Dickson <steved@redhat.com>
Date: Thu, 7 Apr 2016 11:20:40 -0400
Subject: [PATCH] nss.c: wrong check of return value

Fixed some NEGATIVE_RETURNS that a Covscan scan found.

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 nss.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/nss.c
+++ b/nss.c
@@ -186,6 +186,9 @@ static struct passwd *nss_getpwnam(const
 	char *localname;
 	int err = ENOMEM;
 
+	if (buflen < 0)
+		goto err;
+
 	buf = malloc(sizeof(*buf) + buflen);
 	if (buf == NULL)
 		goto err;
@@ -313,8 +316,11 @@ static int _nss_name_to_gid(char *name,
 		}
 	}
 
+	err = -ENOMEM;
+	if (buflen < 0)
+		goto out;
+
 	do {
-		err = -ENOMEM;
 		buf = malloc(buflen);
 		if (!buf)
 			goto out_name;
openSUSE Build Service is sponsored by