[PATCH 02/13] newgrp: use xstrdup to check allocation succeeded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 login-utils/newgrp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/login-utils/newgrp.c b/login-utils/newgrp.c
index 6269547..55dad1b 100644
--- a/login-utils/newgrp.c
+++ b/login-utils/newgrp.c
@@ -32,6 +32,7 @@
 #include "closestream.h"
 #include "nls.h"
 #include "pathnames.h"
+#include "xalloc.h"
 
 /* try to read password from gshadow */
 static char *get_gshadow_pwd(char *groupname)
@@ -67,7 +68,7 @@ static char *get_gshadow_pwd(char *groupname)
 		}
 	}
 	fclose(f);
-	return pwd ? strdup(pwd) : NULL;
+	return pwd ? xstrdup(pwd) : NULL;
 }
 
 static int allow_setgid(struct passwd *pe, struct group *ge)
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux