pwrap: Make sure pam_library is null-terminated
authorAndreas Schneider <asn@samba.org>
Wed, 13 Jan 2016 09:54:36 +0000 (10:54 +0100)
committerAndreas Schneider <asn@samba.org>
Wed, 13 Jan 2016 10:45:50 +0000 (11:45 +0100)
We initialize the array with 0. So do not pass the full size of the
array to make sure the last byte is a null byte.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
src/pam_wrapper.c

index 9b27bc3ba214c42a6210e5c9215d6515deaf5565..0c451d17466799015733e88f36decf4f577eb48b 100644 (file)
@@ -879,7 +879,7 @@ static void pwrap_init(void)
                  "PAM path: %s",
                  libpam_path);
 
-       ret = readlink(libpam_path, pam_library, sizeof(pam_library));
+       ret = readlink(libpam_path, pam_library, sizeof(pam_library) - 1);
        PWRAP_LOG(PWRAP_LOG_TRACE,
                  "PAM library: %s",
                  pam_library);