summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2006-07-27 19:05:12 +0000
committerPaul Jakma <paul.jakma@sun.com>2006-07-27 19:05:12 +0000
commit1893740016d35d75de567a5f6b74db2314ffdc52 (patch)
tree95175d82fa7affe687afe8f9db893aee5746686c
parentf366ad31ae6bf7e2fb7271cf8eab6dee4af3baf9 (diff)
[bgpd] Potential bug#287 fix, peer_delete should NULL out freed buffers
2006-07-27 Paul Jakma <paul.jakma@sun.com> * bgpd.c: (peer_delete) Ensure freed buffers can not be accidently reused. A potential fix for bug #287.
-rw-r--r--bgpd/ChangeLog5
-rw-r--r--bgpd/bgpd.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog
index a8a6c350..90d0e0e3 100644
--- a/bgpd/ChangeLog
+++ b/bgpd/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-27 Paul Jakma <paul.jakma@sun.com>
+
+ * bgpd.c: (peer_delete) Ensure freed buffers can not be
+ accidently reused. A potential fix for bug #287.
+
2006-07-02 Paul Jakma <paul.jakma@sun.com>
* bgp_fsm.c: (bgp_{stop,start}) Move clear/free of certain
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index b574a9aa..8ed598d2 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1205,18 +1205,19 @@ peer_delete (struct peer *peer)
/* Buffers. */
if (peer->ibuf)
stream_free (peer->ibuf);
-
if (peer->obuf)
stream_fifo_free (peer->obuf);
-
if (peer->work)
stream_free (peer->work);
-
+ peer->obuf = NULL;
+ peer->work = peer->ibuf = NULL;
+
/* Local and remote addresses. */
if (peer->su_local)
sockunion_free (peer->su_local);
if (peer->su_remote)
sockunion_free (peer->su_remote);
+ peer->su_local = peer->su_remote = NULL;
bgp_sync_delete (peer);