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
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 @@
continue;
}
+ firmware_value[n] = '\0';
+
if (strlen(FIRMWARE_BASE) + strlen(firmware_value) + 1 > sizeof(path))
continue;