From 944493e47275e8839331a0078a76c704b33a9fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 8 Dec 2020 21:04:45 +0100 Subject: [PATCH] pam_fprintd: Protect usage of strdup for NULL values It's not smart as g_strdup, so need to ensure we don't use it for NULL strings. This is a regression caused by commit bf223662 --- pam/pam_fprintd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pam/pam_fprintd.c b/pam/pam_fprintd.c index 902c59b..02caf07 100644 --- a/pam/pam_fprintd.c +++ b/pam/pam_fprintd.c @@ -155,7 +155,7 @@ open_device (pam_handle_t *pamh, sd_bus_message_exit_container (m); - return strdup (path); + return path ? strdup (path) : NULL; } typedef struct @@ -226,7 +226,7 @@ verify_result (sd_bus_message *m, data->result = NULL; } - if (done) + if (done && result) { data->result = strdup (result); return 0;