mirror of
https://git.proxmox.com/git/wasi-libc
synced 2025-07-13 14:36:44 +00:00
![]() * Link `populate_environ` only if we actually need environment variables. This avoids linking in the environment variable initialization code, and the __wasi_environ_sizes_get and __wasi_environ_get imports, in programs that don't use environment variables. This also removes the "___environ" (three underscores) alias symbol, which is only in musl for backwards compatibility. * Switch to //-style comments. * If malloc fails, don't leave `__environ` pointing to an uninitialized buffer. * Fix a memory leak if one malloc succeeds and the other fails. * Use calloc to handle multiplication overflow. This also handles the NULL terminator. * Don't initialize __environ until everything has succeeded. * Avoid leaking in case __wasi_environ_get fails. * Handle overflow in the add too. * Add #include <stdlib.h> for malloc etc. * If the environment is empty, don't allocate any memory. |
||
---|---|---|
.. | ||
private | ||
public | ||
LICENSE |