Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/ipsec-tools-0_8-branch]: src/crypto/dist/ipsec-tools/src/racoon fixed so...
details: https://anonhg.NetBSD.org/src/rev/32f20b659a5e
branches: ipsec-tools-0_8-branch
changeset: 763324:32f20b659a5e
user: vanhu <vanhu%NetBSD.org@localhost>
date: Thu Nov 17 14:46:31 2011 +0000
description:
fixed some crashes in LIST_FOREACH where current element could be removed during the loop
diffstat:
crypto/dist/ipsec-tools/src/racoon/handler.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diffs (52 lines):
diff -r 4cf60e242fd7 -r 32f20b659a5e crypto/dist/ipsec-tools/src/racoon/handler.c
--- a/crypto/dist/ipsec-tools/src/racoon/handler.c Mon Nov 14 13:25:06 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/handler.c Thu Nov 17 14:46:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: handler.c,v 1.39 2011/03/14 17:18:12 tteras Exp $ */
+/* $NetBSD: handler.c,v 1.39.2.1 2011/11/17 14:46:31 vanhu Exp $ */
/* Id: handler.c,v 1.28 2006/05/26 12:17:29 manubsd Exp */
@@ -611,9 +611,11 @@
struct sockaddr *src, *dst;
u_int32_t spid;
{
- struct ph2handle *p;
+ struct ph2handle *p, *next;
- LIST_FOREACH(p, &ph2tree, chain) {
+ for (p = LIST_FIRST(&ph2tree); p; p = next) {
+ next = LIST_NEXT(p, chain);
+
if (spid == p->spid &&
cmpsaddr(src, p->src) <= CMPSADDR_WILDPORT_MATCH &&
cmpsaddr(dst, p->dst) <= CMPSADDR_WILDPORT_MATCH){
@@ -985,9 +987,11 @@
remcontacted(remote)
struct sockaddr *remote;
{
- struct contacted *p;
+ struct contacted *p, *next;
- LIST_FOREACH(p, &ctdtree, chain) {
+ for (p = LIST_FIRST(&ctdtree); p; p = next) {
+ next = LIST_NEXT(p, chain);
+
if (cmpsaddr(remote, p->remote) <= CMPSADDR_WILDPORT_MATCH) {
LIST_REMOVE(p, chain);
racoon_free(p->remote);
@@ -1555,10 +1559,12 @@
purgeph1bylogin(login)
char *login;
{
- struct ph1handle *p;
+ struct ph1handle *p, *next;
int found = 0;
- LIST_FOREACH(p, &ph1tree, chain) {
+ for (p = LIST_FIRST(&ph1tree); p; p = next) {
+ next = LIST_NEXT(p, chain);
+
if (p->mode_cfg == NULL)
continue;
if (strncmp(p->mode_cfg->login, login, LOGINLEN) == 0) {
Home |
Main Index |
Thread Index |
Old Index