mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 02:20:48 +00:00
Fix null pointer check in tokenFilename()
From https://scan.coverity.com/projects/chromium-ec : CID61407: Dereference after null check The home directory that is received from getpwuid() needs to be assigned to home but it wasn't. BUG=none BRANCH=none TEST=build tested Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Change-Id: I36c30906e1388e2f8a0d466d516a5ffa6ae70bf6 Reviewed-on: https://chromium-review.googlesource.com/324637 Commit-Ready: Stefan Reinauer <reinauer@chromium.org> Tested-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
c8484a9138
commit
4f6f505900
@@ -294,7 +294,8 @@ void getPIN(uint8_t* out) {
|
|||||||
static
|
static
|
||||||
std::string tokenFilename(const uint8_t* fp) {
|
std::string tokenFilename(const uint8_t* fp) {
|
||||||
const char* home = getenv("HOME");
|
const char* home = getenv("HOME");
|
||||||
if (home == NULL) getpwuid(getuid())->pw_dir;
|
if (home == NULL)
|
||||||
|
home = getpwuid(getuid())->pw_dir;
|
||||||
std::string s(home);
|
std::string s(home);
|
||||||
s.append("/.tmp/");
|
s.append("/.tmp/");
|
||||||
for (int i = 0; i < 32; ++i) {
|
for (int i = 0; i < 32; ++i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user