]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: use memdup_suffix0() when copying string from potentially binary data
authorLennart Poettering <lennart@poettering.net>
Tue, 18 Jun 2019 13:56:07 +0000 (15:56 +0200)
committerEvgeny Vereshchagin <evvers@ya.ru>
Tue, 18 Jun 2019 17:53:46 +0000 (20:53 +0300)
Fixes: #12484
src/journal/journald-native.c

index 4efe34c6646cb5b32ba3c48ee6096554be35eaa1..73a96da9f7a99d65b91f39a559dd1a0fe328997d 100644 (file)
@@ -63,7 +63,7 @@ static void server_process_entry_meta(
                  startswith(p, "SYSLOG_IDENTIFIER=")) {
                 char *t;
 
-                t = strndup(p + 18, l - 18);
+                t = memdup_suffix0(p + 18, l - 18);
                 if (t) {
                         free(*identifier);
                         *identifier = t;
@@ -73,7 +73,7 @@ static void server_process_entry_meta(
                    startswith(p, "MESSAGE=")) {
                 char *t;
 
-                t = strndup(p + 8, l - 8);
+                t = memdup_suffix0(p + 8, l - 8);
                 if (t) {
                         free(*message);
                         *message = t;