diff options
author | Martin Roth <martinroth@chromium.org> | 2016-09-27 09:34:54 -0600 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-09-28 22:09:23 -0700 |
commit | a5f66d9658ba13b19542fcb65e00396225256b1c (patch) | |
tree | 2c6a0169fade0f0c8cca6af7f2f12e5b02f2f4e4 /util | |
parent | d2ee66555a4ef43820aa8c5dd920f2924e849526 (diff) | |
download | chrome-ec-a5f66d9658ba13b19542fcb65e00396225256b1c.tar.gz |
util/signer/gnubby.c: set home dir correctly
If HOME is not set in the environment, the variable 'home' was getting
looked up, but not set. This sets the variable.
From https://scan.coverity.com/projects/chromium-ec :
CID61407: Dereference after null check
BUG=chromium:632768
TEST=Built all boards
BRANCH=None
Previously fixed in commit 4f6f505900a
Change-Id: I77614ed96b5247fc7c6b08d810ea87150ff3adfd
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/390411
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/signer/gnubby.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/util/signer/gnubby.cc b/util/signer/gnubby.cc index 478d77470f..77cd5eb2a3 100644 --- a/util/signer/gnubby.cc +++ b/util/signer/gnubby.cc @@ -294,7 +294,8 @@ void getPIN(uint8_t* out) { static std::string tokenFilename(const uint8_t* fp) { const char* home = getenv("HOME"); - if (home == NULL) getpwuid(getuid())->pw_dir; + if (home == NULL) + home = getpwuid(getuid())->pw_dir; std::string s(home); s.append("/.tmp/"); for (int i = 0; i < 32; ++i) { |