summaryrefslogtreecommitdiffstats
path: root/nest
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2001-01-08 12:13:01 +0100
committerMartin Mares <mj@ucw.cz>2001-01-08 12:13:01 +0100
commit8c6ce98b9d9b5c4970e902cf667c1ffb64f04a62 (patch)
tree9b05a5e12e8569c8ab7f584c8afa8ea6d203fb5d /nest
parent32749f493fdaea31f70d8586597febacd2c511d9 (diff)
downloadbird-8c6ce98b9d9b5c4970e902cf667c1ffb64f04a62.tar
bird-8c6ce98b9d9b5c4970e902cf667c1ffb64f04a62.zip
Fixed infinite recursion in password_same.
Pavel, please check.
Diffstat (limited to 'nest')
-rw-r--r--nest/password.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/nest/password.c b/nest/password.c
index c270627..ba5d0e6 100644
--- a/nest/password.c
+++ b/nest/password.c
@@ -54,12 +54,19 @@ password_strncpy(char *to, char *from, int len)
int
password_same(struct password_item *old, struct password_item *new)
{
- if (old == new)
- return 1;
- if ((!old) || (!new))
- return 0;
- return ((old->from == new->from) &&
- (old->to == new->to) &&
- (old->passive == new->passive) &&
- password_same(old, new));
+ for(;;)
+ {
+ if (old == new)
+ return 1;
+ if (!old || !new)
+ return 0;
+ if (old->from != new->from ||
+ old->to != new->to ||
+ old->passive != new->passive ||
+ old->id != new->id ||
+ strcmp(old->password, new->password))
+ return 0;
+ old = old->next;
+ new = new->next;
+ }
}