summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2018-09-05 10:21:22 +0300
committerTimo Teräs <timo.teras@iki.fi>2018-09-05 10:21:22 +0300
commit7b654e125461b00bc26e52b25e6a7be3a32c11b9 (patch)
tree57ad28f6719a8e46d5ca4bc974ccdb079c62603d
parent13c534db7755865380bfd930aa384aebc16347e6 (diff)
downloadapk-tools-7b654e125461b00bc26e52b25e6a7be3a32c11b9.tar.bz2
apk-tools-7b654e125461b00bc26e52b25e6a7be3a32c11b9.tar.xz
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>
-rw-r--r--src/apk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/apk.c b/src/apk.c
index 04b41d4..246e037 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -689,5 +689,7 @@ err:
apk_string_array_free(&args);
free(apk_argv);
+ if (r < 0) r = 250;
+ if (r > 99) r = 99;
return r;
}