From 6bfeb0e282411079051193b13784789717f7792f Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Mon, 20 Feb 2017 16:43:41 +0100 Subject: [PATCH] NULL proctect ft_strchr --- libft/Makefile | 2 +- libft/src/str/ft_strappend.c | 2 +- libft/src/str/ft_strchr.c | 4 +++- libft/src/str/ft_strdel.c | 2 +- libft/src/str/ft_strjoin.c | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libft/Makefile b/libft/Makefile index b0276568..2ca12782 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -6,7 +6,7 @@ # By: jhalford +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2017/02/07 16:09:36 by jhalford #+# #+# # -# Updated: 2017/02/17 17:31:38 by jhalford ### ########.fr # +# Updated: 2017/02/19 05:42:56 by jhalford ### ########.fr # # # # **************************************************************************** # diff --git a/libft/src/str/ft_strappend.c b/libft/src/str/ft_strappend.c index 3aab80d4..2e52529d 100644 --- a/libft/src/str/ft_strappend.c +++ b/libft/src/str/ft_strappend.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 12:16:31 by jhalford #+# #+# */ -/* Updated: 2017/02/09 17:34:47 by jhalford ### ########.fr */ +/* Updated: 2017/02/19 05:50:12 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libft/src/str/ft_strchr.c b/libft/src/str/ft_strchr.c index 7263e413..c2ad43f6 100644 --- a/libft/src/str/ft_strchr.c +++ b/libft/src/str/ft_strchr.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/03 14:57:53 by jhalford #+# #+# */ -/* Updated: 2016/11/03 15:07:30 by jhalford ### ########.fr */ +/* Updated: 2017/02/20 16:43:10 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,6 +16,8 @@ char *ft_strchr(const char *s, int c) { char *a; + if (!s) + return (NULL); a = (char *)s; while (*a) { diff --git a/libft/src/str/ft_strdel.c b/libft/src/str/ft_strdel.c index d7753703..f9eb34e4 100644 --- a/libft/src/str/ft_strdel.c +++ b/libft/src/str/ft_strdel.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/03 14:58:00 by jhalford #+# #+# */ -/* Updated: 2016/12/07 17:14:22 by jhalford ### ########.fr */ +/* Updated: 2017/02/19 05:47:47 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libft/src/str/ft_strjoin.c b/libft/src/str/ft_strjoin.c index 3c67e018..2c064f33 100644 --- a/libft/src/str/ft_strjoin.c +++ b/libft/src/str/ft_strjoin.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/03 14:58:18 by jhalford #+# #+# */ -/* Updated: 2017/01/22 17:46:33 by jhalford ### ########.fr */ +/* Updated: 2017/02/19 05:50:20 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */