daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
9fc0f6
From 865e6e46f235bc9c58e61024696fff216e7a2182 Mon Sep 17 00:00:00 2001
9fc0f6
From: Lennart Poettering <lennart@poettering.net>
9fc0f6
Date: Mon, 7 Jul 2014 17:32:44 +0200
9fc0f6
Subject: [PATCH] service: don't accept negative ERRNO= notification messages
9fc0f6
9fc0f6
(cherry picked from commit 2040ccf171404b709acb0ecf1d1f17b87c5d05f0)
9fc0f6
9fc0f6
Related: #1106457
9fc0f6
---
9fc0f6
 src/core/service.c | 2 +-
9fc0f6
 1 file changed, 1 insertion(+), 1 deletion(-)
9fc0f6
9fc0f6
diff --git a/src/core/service.c b/src/core/service.c
9fc0f6
index 3f6c8ac..814019d 100644
9fc0f6
--- a/src/core/service.c
9fc0f6
+++ b/src/core/service.c
9fc0f6
@@ -3534,7 +3534,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
9fc0f6
         if (e) {
9fc0f6
                 int status_errno;
9fc0f6
 
9fc0f6
-                if (safe_atoi(e + 6, &status_errno) < 0)
9fc0f6
+                if (safe_atoi(e + 6, &status_errno) < 0 || status_errno < 0)
9fc0f6
                         log_warning_unit(u->id, "Failed to parse ERRNO= field in notification message: %s", e);
9fc0f6
                 else {
9fc0f6
                         log_debug_unit(u->id, "%s: got %s", u->id, e);