fix autre invalid read

This commit is contained in:
tom moron
2024-05-05 20:38:05 +02:00
parent 43e4d054b5
commit 28efa75b39

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */ /* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */
/* Updated: 2024/05/05 20:21:43 by tomoron ### ########.fr */ /* Updated: 2024/05/05 20:36:59 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -31,10 +31,13 @@ int get_var_len(char **command, t_env *env)
if (**command == '\'' || **command == '"') if (**command == '\'' || **command == '"')
{ {
(*command)--; (*command)--;
return(0); return (0);
} }
if (!**command) if (!**command)
{
(*command)--;
return (1); return (1);
}
if (!ft_isalnum(**command) && **command != '_' && **command != '?') if (!ft_isalnum(**command) && **command != '_' && **command != '?')
return (2); return (2);
if (**command == '?') if (**command == '?')