From b8de5f2d43e1c560d3b8cad2eb63b379ae547b9c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 24 Aug 2009 15:23:22 +0200 Subject: [PATCH] client: add a limit to the loop (FS#573) Signed-off-by: Julien Danjou --- client.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client.h b/client.h index 93105d0c0..6556f0912 100644 --- a/client.h +++ b/client.h @@ -223,8 +223,10 @@ client_raise(client_t *c) client_t *tc = c; int counter = 0; - /* Find number of transient layers. */ - for(counter = 0; tc->transient_for; counter++) + /* Find number of transient layers. + * We limit the counter to the stack length: if some case, a buggy + * application might set transient_for as a loop… */ + for(counter = 0; tc->transient_for && counter <= globalconf.stack.len; counter++) tc = tc->transient_for; /* Push them in reverse order. */