From e611af505f8d411c5f11c012eaaafeb28cabe0c4 Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Sat, 22 Mar 2014 23:05:54 -0700 Subject: [PATCH] Backport memory fix (2014-03-23T05:15:48Z!dancol@dancol.org) from trunk --- src/ChangeLog | 5 +++++ src/process.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index dbfb1436fe1..48fc2262e92 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-03-23 Daniel Colascione + + * process.c (DATAGRAM_CONN_P): Don't underflow datagram_address + array. (ASAN caught.) + 2014-03-21 YAMAMOTO Mitsuharu Fix regression introduced by patch for Bug#10500. diff --git a/src/process.c b/src/process.c index 187627dd85a..6f89408b5ee 100644 --- a/src/process.c +++ b/src/process.c @@ -353,7 +353,10 @@ static struct sockaddr_and_len { int len; } datagram_address[FD_SETSIZE]; #define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0) -#define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XPROCESS (proc)->infd].sa != 0) +#define DATAGRAM_CONN_P(proc) \ + (PROCESSP (proc) && \ + XPROCESS (proc)->infd >= 0 && \ + datagram_address[XPROCESS (proc)->infd].sa != 0) #else #define DATAGRAM_CHAN_P(chan) (0) #define DATAGRAM_CONN_P(proc) (0) -- 2.39.2