apex: fix potential use-after-free of stack memory
`fake_buf` currently reaches the end of its lifetime at the end of
`getpwnam`. Thus, we get undefined behavior if it's used by the caller
of `getpwnam`. Making it `static` fixes this.
Caught by the static analyzer:
> system/apex/tools/host_apex_verifier.cc:49:3: warning: Address of
stack memory associated with local variable 'fake_buf' is still referred
to by the static variable 'fake_passwd' upon returning to the caller.
This will be a dangling reference
[clang-analyzer-core.StackAddressEscape]
Bug: 206470603
Test: Builds locally
Change-Id: If3ddd960cf108eb33bd3b729b5176bd8e201d7f3
1 file changed