teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0173-bus-message-also-properly-copy-struct-signature-when.patch

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