hermit-os / kernel

A Rust-based, lightweight unikernel.
http://hermit-os.org
Apache License 2.0
1.16k stars 85 forks source link

Fixed missing NULLPTR at the end of the environment list from uhyve #1293

Closed jounathaen closed 3 months ago

jounathaen commented 3 months ago

Another one of these "How has this worked before" bugs:

env is a vector of pointers where uhyve writes the environment variables into. This vector is then cast into a pointer and passed to std::sys::pal::hermit::os::init_environment, where a hashmap is built from this list by iterating over the pointers. The stop-condition of this iteration is a nullptr, but we never added that to the vector. Probably it worked before because the memory at the end of the list was zero by chance, but it failed now on my machine.

I appreciate any second thoughts because I'm skeptical as the bug has not triggered before.