translate: Null terminate firmware_value string

Null terminate firmware_value string to prevent
strlen() read past the end of buffer.

Change-Id: I57cd01c4d0c58c6057872bc4b36129f09bc034a3
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
John Stultz
2020-02-24 13:07:49 +05:30
committed by Bjorn Andersson
parent 538efb3096
commit de42697a24

View File

@@ -109,6 +109,7 @@ static int translate_readonly(const char *file)
if (n < 0) {
continue;
}
firmware_value[n] = '\0';
if (strlen(FIRMWARE_BASE) + strlen(firmware_value) + 1 +
strlen(file) + 1 > sizeof(path))