From b8e3fddce36e6c07b7851906a73c47a4937c3ad5 Mon Sep 17 00:00:00 2001 From: gwojda Date: Thu, 23 Mar 2017 19:09:12 +0100 Subject: [PATCH] fix invalid read completion --- 42sh/src/completion/c_clear.c | 2 +- 42sh/src/completion/c_find_abspath.c | 4 ++-- 42sh/src/completion/c_find_binary.c | 4 ++-- 42sh/src/completion/c_find_env.c | 4 ++-- 42sh/src/completion/c_find_files.c | 4 ++-- 42sh/src/completion/c_match.c | 2 +- 42sh/src/completion/c_output.c | 2 +- 42sh/src/completion/c_parser.c | 6 +++--- 42sh/src/completion/completion.c | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/42sh/src/completion/c_clear.c b/42sh/src/completion/c_clear.c index 9e27a824..67f8b688 100644 --- a/42sh/src/completion/c_clear.c +++ b/42sh/src/completion/c_clear.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/10 11:37:43 by alao #+# #+# */ -/* Updated: 2017/03/21 14:02:41 by gwojda ### ########.fr */ +/* Updated: 2017/03/23 18:55:43 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/completion/c_find_abspath.c b/42sh/src/completion/c_find_abspath.c index de4d0a44..15501de0 100644 --- a/42sh/src/completion/c_find_abspath.c +++ b/42sh/src/completion/c_find_abspath.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/09 16:54:59 by gwojda #+# #+# */ -/* Updated: 2017/03/23 15:42:37 by gwojda ### ########.fr */ +/* Updated: 2017/03/23 19:07:47 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,5 +37,5 @@ void c_seek_abs_path(t_comp *c, char *current_word) c_parser(c, c->cpath, c->match); if (c->lst == NULL || c->lst == c->lst->prev) c_exclusion_folder(c); - c_lst_id(c); + c_lst_id(data_singleton()->comp); } diff --git a/42sh/src/completion/c_find_binary.c b/42sh/src/completion/c_find_binary.c index 88ad164e..59344970 100644 --- a/42sh/src/completion/c_find_binary.c +++ b/42sh/src/completion/c_find_binary.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/09 13:30:57 by alao #+# #+# */ -/* Updated: 2017/03/23 15:41:12 by gwojda ### ########.fr */ +/* Updated: 2017/03/23 19:07:52 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,6 +35,6 @@ int c_seek_binary(t_data *s, t_comp *c) c_parser(c, paths[i++], c->rcmd); tmp ? ft_memdel((void *)&tmp) : (0); paths ? ft_sstrfree(paths) : (0); - c_lst_id(c); + c_lst_id(data_singleton()->comp); return (0); } diff --git a/42sh/src/completion/c_find_env.c b/42sh/src/completion/c_find_env.c index a80c60db..18686006 100644 --- a/42sh/src/completion/c_find_env.c +++ b/42sh/src/completion/c_find_env.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/09 15:50:24 by gwojda #+# #+# */ -/* Updated: 2017/03/23 15:41:19 by gwojda ### ########.fr */ +/* Updated: 2017/03/23 19:07:56 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -50,6 +50,6 @@ int c_seek_env(t_comp *c, char *current_word) c_addnode(c, ft_strndup(env[i], ft_strchr(env[i], '=') - env[i])); ++i; } - c_lst_id(c); + c_lst_id(data_singleton()->comp); return (0); } diff --git a/42sh/src/completion/c_find_files.c b/42sh/src/completion/c_find_files.c index 854d3b49..fa575bf7 100644 --- a/42sh/src/completion/c_find_files.c +++ b/42sh/src/completion/c_find_files.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/09 13:31:21 by alao #+# #+# */ -/* Updated: 2017/03/23 15:42:46 by gwojda ### ########.fr */ +/* Updated: 2017/03/23 19:08:08 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -105,6 +105,6 @@ int c_seek_files(t_data *s, t_comp *c, char *current_word) if (c->match && ft_strequ(c->match, c->lst->name)) c_exclusion_folder(c); } - c_lst_id(c); + c_lst_id(data_singleton()->comp); return (0); } diff --git a/42sh/src/completion/c_match.c b/42sh/src/completion/c_match.c index fa560399..77fe9600 100644 --- a/42sh/src/completion/c_match.c +++ b/42sh/src/completion/c_match.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/10/15 13:27:14 by alao #+# #+# */ -/* Updated: 2017/03/22 16:20:03 by gwojda ### ########.fr */ +/* Updated: 2017/03/23 19:02:28 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/completion/c_output.c b/42sh/src/completion/c_output.c index ed2a512d..8b5faf28 100644 --- a/42sh/src/completion/c_output.c +++ b/42sh/src/completion/c_output.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/03 13:10:38 by alao #+# #+# */ -/* Updated: 2017/03/22 18:20:29 by alao ### ########.fr */ +/* Updated: 2017/03/23 19:00:05 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/completion/c_parser.c b/42sh/src/completion/c_parser.c index 0625ad20..7d99ebac 100644 --- a/42sh/src/completion/c_parser.c +++ b/42sh/src/completion/c_parser.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/09 13:52:07 by alao #+# #+# */ -/* Updated: 2017/03/23 16:12:05 by gwojda ### ########.fr */ +/* Updated: 2017/03/23 19:05:34 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,9 +18,9 @@ void c_lst_id(t_comp *c) int i; i = 1; - lst = c->lst; - if (!lst) + if (!c || !c->lst) return ; + lst = c->lst; lst->cursor = 1; if (!lst) return ; diff --git a/42sh/src/completion/completion.c b/42sh/src/completion/completion.c index d5f82ffa..2a5f7afb 100644 --- a/42sh/src/completion/completion.c +++ b/42sh/src/completion/completion.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/09/20 14:50:33 by alao #+# #+# */ -/* Updated: 2017/03/22 12:00:27 by alao ### ########.fr */ +/* Updated: 2017/03/23 18:58:47 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */