FIX: exit if str is null

This commit is contained in:
2026-01-09 14:57:42 +01:00
parent 7db1844447
commit 15ca9cfe3f

View File

@@ -6,7 +6,7 @@
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/08 14:30:38 by dgaillet #+# #+# */
/* Updated: 2026/01/09 12:05:56 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/09 14:55:16 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
@@ -17,6 +17,6 @@ void secure_write(int fd, char *str, int len)
{
if (len < 0)
return ;
if (write(fd, str, len) < 0)
if (!str || write(fd, str, len) < 0)
exit (EXIT_FAILURE);
}