diff --git a/lib/nss.c b/lib/nss.c index 1aa27f3e..e6776fb1 100644 --- a/lib/nss.c +++ b/lib/nss.c @@ -69,7 +69,8 @@ void nss_init(const char *nsswitch_path) { atomic_store(&nss_init_completed, true); return; } - while ((getline(&line, &len, nssfp)) != -1) { + p = NULL; + while (getline(&line, &len, nssfp) != -1) { if (line[0] == '#') continue; if (strlen(line) < 8) @@ -82,6 +83,9 @@ void nss_init(const char *nsswitch_path) { if (*p != '\0') break; } + if (p == NULL) { + goto null_subid; + } token = strtok_r(p, " \n\t", &saveptr); if (token == NULL) { fprintf(shadow_logfd, "No usable subid NSS module found, using files\n");