NagiosEnterprises / nrpe

NRPE Agent
GNU General Public License v2.0
263 stars 134 forks source link

nrpe 3.1.1 segfaults if nrpe_user not set on EL7 #146

Closed smooge closed 7 years ago

smooge commented 7 years ago

Downstream bug is https://bugzilla.redhat.com/show_bug.cgi?id=1467808

Problem is if the nrpe_user is not defined in the config file. This causes a segfault in utils.c

    pw = (struct passwd *)getpwnam(nrpe_user);
    if (pw == NULL) {
            char    *end = NULL;
            uid_t   uid = strtol(nrpe_user, &end, 10);
            if (uid > 0)
                    pw = (struct passwd *)getpwuid(uid);
            if (pw == NULL || *end != '\0')
                    return OK;
    }

as nrpe_user is NULL

peternijssen commented 7 years ago

I can confirm that a segfault occurs on EL7 when nrpe_user is not set. I have the same issue here.

hedenface commented 7 years ago

Confirmed on a few different OS here. Fixed in https://github.com/NagiosEnterprises/nrpe/commit/cebaf156d5aab00e90c35a266edd1f47cefedf2c Thanks @smooge! Thanks @peternijssen!