diff options
-rw-r--r-- | pam-ck-connector/pam-ck-connector.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pam-ck-connector/pam-ck-connector.c b/pam-ck-connector/pam-ck-connector.c index 949a9b0..65c08d6 100644 --- a/pam-ck-connector/pam-ck-connector.c +++ b/pam-ck-connector/pam-ck-connector.c @@ -189,13 +189,16 @@ _util_name_to_uid (const char *username, int rc; uid_t res; char *buf = NULL; - unsigned int bufsize; + long bufsize; struct passwd pwd; struct passwd *pwdp; res = (uid_t) -1; bufsize = sysconf (_SC_GETPW_R_SIZE_MAX); + if (bufsize == -1) { + return res; + } buf = calloc (sizeof (char), bufsize); rc = getpwnam_r (username, &pwd, buf, bufsize, &pwdp); if (rc != 0 || pwdp == NULL) { |