mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-16 13:20:41 +01:00
Fix non-null-terminated-string used with strlen
The `failedmsg_entry` expects a null-terminated string in `key`, but here we allocate with malloc and copy a string-with-length-n into only the first n bytes. If the final byte is null, this is by coincidence only. We've observed this by means of seeing random binary data appended to keys submitted to kafka apparently at random, and this looks like a smoking gun.
This commit is contained in:
parent
a854538eb6
commit
2c8c9db065
@ -350,6 +350,7 @@ const size_t msglen, const char *const topicname)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memcpy(etry->key, key, keylen);
|
memcpy(etry->key, key, keylen);
|
||||||
|
etry->key[keylen] = '\0';
|
||||||
} else {
|
} else {
|
||||||
etry->key=NULL;
|
etry->key=NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user