systemd/0030-systemd-run-add-some-extra-safety-checks.patch
Zbigniew Jędrzejewski-Szmek 96237b5868 Bugfix backports
2014-03-07 00:44:59 -05:00

33 lines
1.3 KiB
Diff

From 37c3628037acb728660222ad836047c8bb81363f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 5 Mar 2014 03:38:36 +0100
Subject: [PATCH] systemd-run: add some extra safety checks
(cherry picked from commit 1ac67edb7c4d31a287fa98c0b554ae98bd34e71b)
---
src/run/run.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/run/run.c b/src/run/run.c
index 885d881..7f08c41 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -37,7 +37,7 @@ static const char *arg_description = NULL;
static const char *arg_slice = NULL;
static bool arg_send_sighup = false;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
-static char *arg_host = NULL;
+static const char *arg_host = NULL;
static bool arg_user = false;
static const char *arg_service_type = NULL;
static const char *arg_exec_user = NULL;
@@ -183,7 +183,7 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_NICE:
r = safe_atoi(optarg, &arg_nice);
- if (r < 0) {
+ if (r < 0 || arg_nice < PRIO_MIN || arg_nice >= PRIO_MAX) {
log_error("Failed to parse nice value");
return -EINVAL;
}