journald: use memdup_suffix0() when copying string from potentially binary data

Fixes: #12484
This commit is contained in:
Lennart Poettering 2019-06-18 15:56:07 +02:00 committed by Evgeny Vereshchagin
parent 1faba68fd7
commit d9adc8a863

View 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;