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:
Rainer Gerhards 2026-05-28 13:07:21 +02:00 committed by GitHub
commit 202378969d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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