Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CHROMIUM: bq27x00: Fix OOB write in model name
The BQ27500_MAX_NAME_LEN is now 7 and when we are unable to read the model name we strcpy "unknown" to the model name variable which will cause out of bound write because of \0 at the end of the string. To address this issue, this patch does 3 things. - Increase model name max length from 7 to 20 - Truncate model name when length >= 20 - Change strcpy to strlcpy BUG=chromium:581343 TEST=build / ryu boot Change-Id: Ibf2003be17aed991568d98dfe50bbe72ef5a8292 Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/324058 Reviewed-by: David Riley <davidriley@chromium.org> (cherry picked from commit f8e84e6) Reviewed-on: https://chrome-internal-review.googlesource.com/246295 Reviewed-by: David Riley <davidriley@google.com> Commit-Queue: Andrew Bresticker <abrestic@google.com> Tested-by: Andrew Bresticker <abrestic@google.com>
- Loading branch information