]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
Use default value if _SC_GETPW_R_SIZE_MAX is unavailable. 582/head
authorPhilip Lorenz <philip@bithub.de>
Sun, 3 Jan 2016 23:14:45 +0000 (00:14 +0100)
committerÉrico Rolim <erico.erc@gmail.com>
Sat, 10 Oct 2020 03:53:30 +0000 (00:53 -0300)
sysconf may return -1 if the value is unlimited.

pam/pam_snapper.c

index 7d1c0f9697beffb3a61980b5150cb70d48bdb308..9c581fe9b02d5930f3c024a0602f74fba0a7f8cd 100644 (file)
@@ -518,6 +518,9 @@ static int get_ugid( pam_handle_t * pamh, const char *pam_user, uid_t * uid, gid
        struct passwd *result;
 
        long bufsize = sysconf( _SC_GETPW_R_SIZE_MAX );
+       if (bufsize == -1) {
+               bufsize = 1024;
+       }
        char buf[bufsize];
 
        if ( getpwnam_r( pam_user, &pwd, buf, bufsize, &result ) != 0 || result != &pwd ) {