diff options
author | Angela Stegmaier <angelabaker@ti.com> | 2016-05-10 11:28:00 -0500 |
---|---|---|
committer | Angela Stegmaier <angelabaker@ti.com> | 2016-05-12 12:34:36 -0500 |
commit | b42c76fb8599a3651f6b79e2003bab2346b87063 (patch) | |
tree | 7335d851470f6305fa2f52e219209b05036993c7 | |
parent | a137daabcd5390075b0d1fcb9aed38dec68ad587 (diff) | |
download | ipc-b42c76fb8599a3651f6b79e2003bab2346b87063.tar.gz |
Linux: GateMP: Check for Proper NameServer Value Length
After getting the NameServer value for _GateMP_TI_dGate, check
to make sure that the length is equal to the expected value.
This is to prevent using some uninitialized values to configure
the GateMP. Indirectly, this can help check if hostSupport
has been enabled on the remote processor or not, because
currently, only if hostSupport has been enabled are there 4
entries. Otherwise there are only 2 entries.
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-rw-r--r-- | linux/src/api/gates/GateMP.c | 6 | ||||
-rw-r--r-- | linux/src/daemon/GateMP_daemon.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/linux/src/api/gates/GateMP.c b/linux/src/api/gates/GateMP.c index e71629d..9a0024f 100644 --- a/linux/src/api/gates/GateMP.c +++ b/linux/src/api/gates/GateMP.c @@ -390,6 +390,12 @@ Int GateMP_open(String name, GateMP_Handle *handle) *handle = NULL; status = GateMP_E_NOTFOUND; } + else if (len != sizeof(nsValue)) { + *handle = NULL; + status = GateMP_E_NOTFOUND; + PRINTVERBOSE0("GateMP configuration not valid for hostSupport. " + "Try adding hostSupport to your config if it is needed.\n"); + } else { arg = nsValue[2]; mask = nsValue[3]; diff --git a/linux/src/daemon/GateMP_daemon.c b/linux/src/daemon/GateMP_daemon.c index a7b9210..56b2ad6 100644 --- a/linux/src/daemon/GateMP_daemon.c +++ b/linux/src/daemon/GateMP_daemon.c @@ -513,6 +513,12 @@ static Int GateMP_openDefaultGate(GateMP_Handle *handlePtr, UInt16 procId[]) *handlePtr = NULL; status = GateMP_E_NOTFOUND; } + else if (len != sizeof(nsValue)) { + *handlePtr = NULL; + status = GateMP_E_NOTFOUND; + LOG0("GateMP configuration not valid for hostSupport. " + "Try adding hostSupport to your config if it is needed.\n"); + } else { arg = nsValue[2]; mask = nsValue[3]; |