changeset 17536:1abf8621981a

auth: Added assert to make sure sysconf() returns what we expect. userdb nss shouldn't even be used though. So this is mainly to silence Coverity.
author Timo Sirainen <tss@iki.fi>
date Fri, 27 Jun 2014 17:37:56 +0300
parents 31efe2d04793
children 3f9d15b600b1
files src/auth/userdb-nss.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/userdb-nss.c	Fri Jun 27 16:29:18 2014 +0300
+++ b/src/auth/userdb-nss.c	Fri Jun 27 17:37:56 2014 +0300
@@ -104,9 +104,13 @@
 {
 	struct nss_userdb_module *module;
 	const char *const *tmp;
+	long bufsize;
+
+	bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+	i_assert(bufsize > 0);
 
 	module = p_new(pool, struct nss_userdb_module, 1);
-	module->bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+	module->bufsize = bufsize;
 	module->buf = p_malloc(pool, module->bufsize);
 	module->module.blocking = TRUE;