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

liblutil/ultils.c: lutil_localtime() <g-differential> timestamp format bug?



Hi,

there seems to be a small problem in "lutil_localtime()" regarding the creation of <g-differential> timestamp formated bervals:

The returned length "ret" (of type: size_t) of a timestamp value in <g-differential> format contains the terminating "\0" which leads to base64 encoded presentation...

For demonstration I've attached a minimal (and probably very dirty) patch which fixed this issue for me, but I'm quite unsure whether:
- it's really a bug or I'm doing something completely wrong
- my patch represents a clean solution.

Therefore I've not opened an ITS. First of all I would appreciate your valuable feedback, whether lutil_localtime() creates <g-differential> timestamps like intended?
Thanks a lot!

Best regards
Daniel
Index: libraries/liblutil/utils.c
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/libraries/liblutil/utils.c,v
retrieving revision 1.70
diff -u -r1.70 utils.c
--- libraries/liblutil/utils.c	20 Nov 2009 19:43:50 -0000	1.70
+++ libraries/liblutil/utils.c	20 Mar 2010 17:15:12 -0000
@@ -147,7 +147,7 @@
 	snprintf( p, smax - 15, "%02ld%02ld", delta / 3600,
 			( delta % 3600 ) / 60 );
 
-	return ret + 5;
+	return ret + 4;
 }
 
 int lutil_tm2time( struct lutil_tm *tm, struct lutil_timet *tt )