Skip to content

Conversation

@dayano74
Copy link
Collaborator

@dayano74 dayano74 commented May 17, 2025

fix #253

 ft_strchrを追加し、入力されたコマンドに/が存在した時、accessでファイルが存在するか検証するようにした。
 カレントディレクトリにコマンド(以降、コマンドをcatとして考える)と同じ名前のファイルがあるときは、get_cmd_pathのaccess(cmd, F_OK)は成功するが、execute_cmdのaccess(fullpath, X_OK)は失敗し、 Permission deniedのエラーメッセージが出力される。
 カレントディレクトリにcatと同じ名前のファイルがないときは、そもそもget_cmd_pathのaccess(cmd, F_OK)の確認には至らず、fullpathが作成される。そして、execute_cmdでcatが実行される。

@dayano74 dayano74 requested a review from cacapon May 17, 2025 05:12
Copy link
Owner

@cacapon cacapon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OKです!

@cacapon cacapon merged commit 7a9eb3c into main May 17, 2025
2 checks passed
@cacapon cacapon deleted the feature/253-validate-command-path branch May 17, 2025 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

コマンドが./がなくても実行できてしまう

3 participants