mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-06-19 10:32:55 +02:00
Merge pull request #7085 from rsyslog/codex/fix-omotlp-invalid-pointer-dereference
omotel: use getProgramName() to avoid unsafe PROGNAME union access
This commit is contained in:
commit
202378969d
@ -1294,7 +1294,7 @@ static const char *cstrToConst(cstr_t *value) {
|
||||
return value == NULL ? NULL : (const char *)rsCStrGetSzStrNoNULL(value);
|
||||
}
|
||||
|
||||
static const char *extractAppName(const smsg_t *msg) {
|
||||
static const char *extractAppName(smsg_t *msg) {
|
||||
const char *candidate;
|
||||
|
||||
if (msg == NULL) {
|
||||
@ -1306,8 +1306,8 @@ static const char *extractAppName(const smsg_t *msg) {
|
||||
return candidate;
|
||||
}
|
||||
|
||||
if (msg->iLenPROGNAME > 0 && msg->PROGNAME.ptr != NULL) {
|
||||
return (const char *)msg->PROGNAME.ptr;
|
||||
if (msg->iLenPROGNAME > 0) {
|
||||
return (const char *)getProgramName(msg, LOCK_MUTEX);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user