diff options
author | Amit Pundir <amit.pundir@linaro.org> | 2020-04-14 22:45:05 +0530 |
---|---|---|
committer | Todd Kjos <tkjos@google.com> | 2020-04-25 15:22:54 +0000 |
commit | 4f619fba658deb64633165bdae0efea47db42952 (patch) | |
tree | ff18079ba379f9fee38b476555d240e8faeae4d4 /qcom | |
parent | aab5ced6ec820b19c167b4ad23cc299b6966e93b (diff) |
qcom: pd-mapper: Null terminate firmware_value string
Null terminate firmware_value string to prevent
strlen() read past the end of buffer.
Otherwise pd-mapper will crash:
console:/ # pd-mapper
FORTIFY: strlen: detected read past end of buffer
Aborted
134|console:/ #
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: Id0b9e1dda2bae12e3a36f1ce40376d1161878894
Diffstat (limited to 'qcom')
-rw-r--r-- | qcom/pd-mapper/pd-mapper.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/qcom/pd-mapper/pd-mapper.c b/qcom/pd-mapper/pd-mapper.c index f26710d..c7db57f 100644 --- a/qcom/pd-mapper/pd-mapper.c +++ b/qcom/pd-mapper/pd-mapper.c @@ -241,6 +241,8 @@ static int pd_enumerate_jsons(struct assoc *json_set) continue; } + firmware_value[n] = '\0'; + if (strlen(FIRMWARE_BASE) + strlen(firmware_value) + 1 > sizeof(path)) continue; |