summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-05-31 12:24:14 +0200
committerSerge Hallyn <serge@hallyn.com>2023-05-31 09:29:49 -0500
commit70399856c1e7ae6bddbe26319895fd53ab895be4 (patch)
treecd7a15589863ac13852d61bd2728c021b1d9f600
parent848a95329c867aae726ae990051700c9ef6541fa (diff)
lib/nss.c: Fix use of invalid p
getline(3) might have succeeded in a previous iteration, in which case p points to an offset that is not valid. Make p NULL at the end of the loop, to make sure it doesn't hold old stuff. Link: <https://github.com/shadow-maint/shadow/pull/737#issuecomment-1568948769> Reported-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--lib/nss.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/nss.c b/lib/nss.c
index e6776fb1..b697f0a0 100644
--- a/lib/nss.c
+++ b/lib/nss.c
@@ -82,6 +82,7 @@ void nss_init(const char *nsswitch_path) {
p++;
if (*p != '\0')
break;
+ p = NULL;
}
if (p == NULL) {
goto null_subid;