diff options
author | Anthony Stange <stange@google.com> | 2019-05-03 14:47:46 -0400 |
---|---|---|
committer | Anthony Stange <stange@google.com> | 2019-05-03 18:49:47 +0000 |
commit | 3126f6c04b3d19c977b7151da310d1a402bd6f98 (patch) | |
tree | 51b4fdeeb9e3f76cae8fb501b36a51ff721005fb | |
parent | ffae9dd4ca26d3c30af6a2f6338df47b2ec264fc (diff) | |
download | chre-3126f6c04b3d19c977b7151da310d1a402bd6f98.tar.gz |
Fix null ptr dereference in platform_nanoapp
Today, we don't check if the app's version string
is non-null before calling strlen. This'll cause
a crash as strlen doesn't check for null inputs.
Bug: 131912580
Test: compile only
Change-Id: I2ed46b7cdee0afcbb07acef21a83c39151b43411
-rw-r--r-- | platform/slpi/platform_nanoapp.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/platform/slpi/platform_nanoapp.cc b/platform/slpi/platform_nanoapp.cc index 2aee4947..0fa302db 100644 --- a/platform/slpi/platform_nanoapp.cc +++ b/platform/slpi/platform_nanoapp.cc @@ -297,7 +297,8 @@ bool PlatformNanoappBase::openNanoappFromBuffer() { const char *PlatformNanoappBase::getAppVersionString() const { const char *versionString = "<undefined>"; - if (mAppInfo != nullptr && mAppInfo->structMinorVersion >= 2) { + if (mAppInfo != nullptr && mAppInfo->structMinorVersion >= 2 + && mAppInfo->appVersionString != NULL) { size_t appVersionStringLength = strlen(mAppInfo->appVersionString); size_t offset = 0; |