From 7b654e125461b00bc26e52b25e6a7be3a32c11b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 5 Sep 2018 10:21:22 +0300 Subject: [PATCH] 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 --- src/apk.c | 2 ++ 1 file changed, 2 insertions(+) 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; }