evlog_new: store a new copy of peeraddr, not a pointer to a buffer.
Starting in sudo 1.9.14, eventlog_free() will free the peeraddr member too so it needs to be dynamically allocated.
This commit is contained in:
@@ -143,7 +143,10 @@ evlog_new(TimeSpec *submit_time, InfoMessage **info_msgs, size_t infolen,
|
||||
}
|
||||
|
||||
/* Client/peer IP address. */
|
||||
evlog->peeraddr = closure->ipaddr;
|
||||
if ((evlog->peeraddr = strdup(closure->ipaddr)) == NULL) {
|
||||
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* Submit time. */
|
||||
if (submit_time != NULL) {
|
||||
|
Reference in New Issue
Block a user