mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
tests: add simple reproducer for cmdlist use-after-free
This commit is contained in:
parent
d303f22b73
commit
ccbd89708f
2 changed files with 26 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
# file are prefixed with test_
|
# file are prefixed with test_
|
||||||
rawtests = \
|
rawtests = \
|
||||||
quote_removal \
|
quote_removal \
|
||||||
|
cmdlist_use_after_free \
|
||||||
metacharacters \
|
metacharacters \
|
||||||
parse_command_lists \
|
parse_command_lists \
|
||||||
parse_pipelines \
|
parse_pipelines \
|
||||||
|
|
|
||||||
25
tests/cmdlist_use_after_free.c
Normal file
25
tests/cmdlist_use_after_free.c
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* cmdlist_use_after_free.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2025/03/03 11:40:37 by khais #+# #+# */
|
||||||
|
/* Updated: 2025/03/03 13:09:12 by khais ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "../src/parser/wordsplit/wordsplit.h"
|
||||||
|
#include "../src/parser/command_list/command_list.h"
|
||||||
|
#include "libft.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
t_wordlist *words = minishell_wordsplit("|");
|
||||||
|
ft_printf("FINISHED PARSING WORDS!\n");
|
||||||
|
t_cmdlist *cmd = cmdlist_from_wordlist(words);
|
||||||
|
assert(cmd == NULL);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue