[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#6497) Infinite loop in translucent.c

Content-Type: text/plain; charset="ISO-8859-15"
Content-Transfer-Encoding: 7bit

masarati@aero.polimi.it wrote:
> Fixed in HEAD; please test.  Thanks, p.

The patch works, however gcc with "-Wall -pedantic" complains that
according to C standards, behaviour of line like this is undefined.

For maximum portability, it is probably best to increment "i"
individually instead, as seen in the attached patch. I apologise for the
inconvenience of patching a tiny bug like this in two stages.

Ondrej Kuznik

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

Content-Type: text/x-patch; name="fix.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="fix.diff"
Content-Description: fix.diff

Index: openldap-2.4.20/servers/slapd/overlays/translucent.c
--- openldap-2.4.20.orig/servers/slapd/overlays/translucent.c	2010-03-25 14:38:21.000000000 +0100
+++ openldap-2.4.20/servers/slapd/overlays/translucent.c	2010-03-25 14:38:38.000000000 +0100
@@ -205,7 +205,8 @@
 			i = c->valx;
 			ch_free( (*an)[i].an_name.bv_val );
 			do {
-				(*an)[i] = (*an)[++i];
+				(*an)[i] = (*an)[i+1];
+				i++;
 			} while ( !BER_BVISNULL( &(*an)[i].an_name ));
 		return 0;