」 feat: Added some security to the parsing

This commit is contained in:
2024-07-03 19:13:43 +02:00
parent 9f25b17170
commit d24f097ae9
6 changed files with 21 additions and 79 deletions

View File

@ -1,34 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_redir.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/28 18:17:26 by adjoly #+# #+# */
/* Updated: 2024/06/30 13:49:21 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "tokenizer.h"
#include "parsing.h"
#include "error_msg.h"
bool check_redir(t_list *redir)
{
t_list *tmp;
t_redirection *tmp_redir;
tmp = redir;
while (tmp)
{
tmp_redir = tmp->content;
if (tmp_redir->sign == HEREDOC && \
!((t_redirection *)(tmp->content))->file_name)
return (send_error_parsing(ERROR_NO_EOF));
if (!((t_redirection *)(tmp->content))->file_name)
return (send_error_parsing(ERROR_NO_REDIR));
tmp = tmp->next;
}
return (false);
}