Skip to content

Commit ac830c5

Browse files
committed
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. --HG-- branch : 1.9
1 parent 8fe76f4 commit ac830c5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

logsrvd/iolog_writer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ evlog_new(TimeSpec *submit_time, InfoMessage **info_msgs, size_t infolen,
143143
}
144144

145145
/* Client/peer IP address. */
146-
evlog->peeraddr = closure->ipaddr;
146+
if ((evlog->peeraddr = strdup(closure->ipaddr)) == NULL) {
147+
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
148+
goto bad;
149+
}
147150

148151
/* Submit time. */
149152
if (submit_time != NULL) {

0 commit comments

Comments
 (0)