Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

env: a NUL byte in a `--file` entry reaches `std::env::set_var` unvalidated and aborts the process (exit 134)

オープン 初心者向け
#14,490 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
cli

調査の方向性

src/uu/env/src/env.rs の331~338行目付近から始め、解析されたエントリから std::env::set_var までの --file パスを追跡します。argv パスを保護している apply_specified_env_vars と比較してください。issue にあるキーと値の NUL ケースを再現し、どちらも診断と panic しない失敗を生成し、exit 134 で終了しないことを確認してください。

索引モデルが issue の本文から書いたものです。

説明

U - env

env --file FILE parses an .env/INI file and passes each key and value straight to std::env::set_var, which panics when either contains a NUL byte. A single NUL anywhere in the file therefore aborts env with a Rust panic instead of a diagnostic.

The argv path (env NAME=VALUE ...) is guarded — apply_specified_env_vars checks for an empty name before calling set_var, but the --file path has no guard at all.

Steps to reproduce

A NUL in the value:

$ printf 'KEY=a\x00b\n' > conf.env
$ env --file conf.env
thread 'main' panicked at library/std/src/env.rs:361:9:
failed to set environment variable `"KEY"` to `"a\0b"`: file name contained an unexpected NUL byte
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ echo $?
134

A NUL in the key does the same:

$ printf 'a\x00b=c\n' > k.env
$ env --file k.env       # exit 134, identical panic

Root cause

https://github.com/uutils/coreutils/blob/2c0e1b981fdce56bb8cc729dffed702ff0410e8e/src/uu/env/src/env.rs#L331-L338

std::env::set_var panics if either argument contains a NUL. Nothing between the parser and this call validates the bytes.

主要言語
Rust
スター
24.2k
フォーク
2.1k
平均マージ
1日 6時間
マージ済み PR(30日)
320

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

uutils/coreutils のほかの issue

uutils/coreutils の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。