summaryrefslogtreecommitdiff
path: root/futility
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2019-09-20 21:35:17 +0200
committerCommit Bot <commit-bot@chromium.org>2019-09-23 21:36:39 +0000
commit14c01ac6c6e80b37e38c8b34d07e8501084ba2a8 (patch)
treeeafde5dae39c7babdf4fcb5005b2cab130a33df0 /futility
parenta4cda9e8a92c1680d39c44090992c3348068e462 (diff)
downloadvboot-14c01ac6c6e80b37e38c8b34d07e8501084ba2a8.tar.gz
futility: also clamp to natural values
Found by Coverity Scan #242 BUG=none BRANCH=none TEST=none Change-Id: I384044d36ee5e2e9d344c7af40d61c5e27fd75b4 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1815239 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
Diffstat (limited to 'futility')
-rw-r--r--futility/updater.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/futility/updater.c b/futility/updater.c
index 07d2d668..b17fe936 100644
--- a/futility/updater.c
+++ b/futility/updater.c
@@ -236,9 +236,11 @@ static int host_get_platform_version(void)
if (strncmp(result, STR_REV, strlen(STR_REV)) == 0)
rev = strtol(result + strlen(STR_REV), NULL, 0);
- /* we should never have that large versions,
+ /* we should never have negative or extremely large versions,
* but clamp just to be sure
*/
+ if (rev < 0)
+ rev = 0;
if (rev > INT_MAX)
rev = INT_MAX;