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

Re: (ITS#5432) syncrepl seg. faults if received a sync cookie with an empty csn= value



rein@basefarm.no wrote:
> Full_Name: Rein Tollevik
> Version: 2.4.8
> OS:
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (84.215.2.34)
>
>
> The attached patch fixes a seg. fault in compare_csns() in syncrepl.c if it
> receives a sync cookie with an empty "csn=" value.

This has been fixed in HEAD.

> syncprov_playlog() in syncprov.c generates such invalid cookies when replaying a
> sessionlog where no entries has been deleted.  The patch also fixes this bug.

This should never happen, since the cookie is not generated if there were no 
deletes recorded.

> diff -u OpenLDAP/servers/slapd/overlays/syncprov.c:1.5
> OpenLDAP/servers/slapd/overlays/syncprov.c:1.6
> --- OpenLDAP/servers/slapd/overlays/syncprov.c:1.5	Fri Mar 14 16:23:48 2008
> +++ OpenLDAP/servers/slapd/overlays/syncprov.c	Tue Mar 18 17:22:41 2008
> @@ -1413,8 +1413,7 @@
>   		num * UUID_LEN, op->o_tmpmemctx );
>   	uuids[0].bv_val = (char *)(uuids + num + 1);
>
> -	delcsn[0].bv_len = 0;
> -	delcsn[0].bv_val = cbuf;
> +	BER_BVZERO(&delcsn[0]);
>   	BER_BVZERO(&delcsn[1]);
>
>   	/* Make a copy of the relevant UUIDs. Put the Deletes up front
> @@ -1453,6 +1452,7 @@
>   			i++;
>   			AC_MEMCPY( cbuf, se->se_csn.bv_val, se->se_csn.bv_len );
>   			delcsn[0].bv_len = se->se_csn.bv_len;
> +			delcsn[0].bv_val = cbuf;
>   			delcsn[0].bv_val[delcsn[0].bv_len] = '\0';
>   		} else {
>   			nmods++;
>
>
>


-- 
   -- Howard Chu
   Chief Architect, Symas Corp.  http://www.symas.com
   Director, Highland Sun        http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP     http://www.openldap.org/project/