From: Alejandro Colomar Date: Wed, 31 May 2023 10:24:14 +0000 (+0200) Subject: lib/nss.c: Fix use of invalid p X-Git-Tag: 4.14.0-rc1~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70399856c1e7ae6bddbe26319895fd53ab895be4;p=thirdparty%2Fshadow.git 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: Reported-by: Serge Hallyn Signed-off-by: Alejandro Colomar --- diff --git a/lib/nss.c b/lib/nss.c index e6776fb1a..b697f0a09 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;