diff options
author | Timo Teräs <timo.teras@iki.fi> | 2018-09-05 10:21:22 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2018-09-06 14:32:43 +0300 |
commit | 7c90fd0529c0358dd04cab0fce506e8a8b191506 (patch) | |
tree | 818824199a09bcc9e522e451722f9d41b5526117 | |
parent | 0ff5e936d9aafa87da803a35f8c83ad38d9aa26c (diff) |
apk: sanitize return value
Most applets return whatever apk_solver_commit() returns. It is the
number of errors found (or negative for hard error). Sanitize the
error value to not give false success exit code in the unlikely case
of errors % 256 == 0.
Reported-by: Max Justicz <max@justi.cz>
(cherry picked from commit 7b654e125461b00bc26e52b25e6a7be3a32c11b9)
-rw-r--r-- | src/apk.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -612,5 +612,8 @@ err: free(ctx); fetchConnectionCacheClose(); + + if (r < 0) r = 250; + if (r > 99) r = 99; return r; } |