ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
ff6046
From 13993b51c5cab806d81a7305c895bafd4cd48876 Mon Sep 17 00:00:00 2001
ff6046
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
ff6046
Date: Sat, 11 Aug 2018 09:02:48 +0200
ff6046
Subject: [PATCH] bus-message: also properly copy struct signature when
ff6046
 skipping
ff6046
ff6046
The change is similar to that in the previous commit, but I don't have
ff6046
a reproducer / test case case for this one, so I'm keeping it seperate.
ff6046
ff6046
(cherry picked from commit 3d338a302f56c0ef0445660d9856794abe1af8b5)
ff6046
ff6046
Resolves: #1696224
ff6046
---
ff6046
 src/libsystemd/sd-bus/bus-message.c | 6 +++---
ff6046
 1 file changed, 3 insertions(+), 3 deletions(-)
ff6046
ff6046
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
ff6046
index 202f1aab30..e71d29f91d 100644
ff6046
--- a/src/libsystemd/sd-bus/bus-message.c
ff6046
+++ b/src/libsystemd/sd-bus/bus-message.c
ff6046
@@ -5036,9 +5036,9 @@ static int message_skip_fields(
ff6046
 
ff6046
                         assert(l >= 2);
ff6046
                         {
ff6046
-                                char sig[l-1], *s;
ff6046
-                                strncpy(sig, *signature + 1, l-1);
ff6046
-                                s = sig;
ff6046
+                                char sig[l + 1], *s = sig;
ff6046
+                                strncpy(sig, *signature + 1, l);
ff6046
+                                sig[l] = '\0';
ff6046
 
ff6046
                                 r = message_skip_fields(m, ri, (uint32_t) -1, (const char**) &s);
ff6046
                                 if (r < 0)