* tests/test-getusershell.c (first_pass): Check the result of malloc.
Make sure '\0' isn't returned from getusershell when there is an empty
line in /etc/shells.
+2024-05-17 Collin Funk <collin.funk1@gmail.com>
+
+ getusershell tests: Fail if empty lines are returned.
+ * tests/test-getusershell.c (first_pass): Check the result of malloc.
+ Make sure '\0' isn't returned from getusershell when there is an empty
+ line in /etc/shells.
+
2024-05-17 Bruno Haible <bruno@clisp.org>
unistd: Fix compilation error with MSVC in C++ mode.
/* Avoid reallocation. */
shell_count = 16;
shells = malloc (shell_count * sizeof (char *));
+ ASSERT (shells != NULL);
for (; (ptr = getusershell ()); ++i)
{
- /* Make sure comments are ignored. */
+ /* Make sure comments and empty lines are ignored. */
ASSERT (ptr[0] != '#');
+ ASSERT (ptr[0] != '\0');
if (i >= shell_count)
{
shell_count *= 2;