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