svn commit: samba r1989 - branches/SAMBA_4_0/source/lib

tridge at samba.org tridge at samba.org
Sat Aug 21 18:15:07 GMT 2004


Author: tridge
Date: 2004-08-21 18:15:07 +0000 (Sat, 21 Aug 2004)
New Revision: 1989

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/&rev=1989&nolog=1

Log:
fixed a couple of bugs in code that assumes sizeof(time_t) == sizeof(int)
Modified:
   branches/SAMBA_4_0/source/lib/gencache.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/gencache.c
===================================================================
--- branches/SAMBA_4_0/source/lib/gencache.c	2004-08-21 12:23:02 UTC (rev 1988)
+++ branches/SAMBA_4_0/source/lib/gencache.c	2004-08-21 18:15:07 UTC (rev 1989)
@@ -250,13 +250,15 @@
 		char* entry_buf = strndup(databuf.dptr, databuf.dsize);
 		char *v;
 		time_t t;
+		unsigned i;
 
 		v = (char*)malloc(sizeof(char) * 
 				  (databuf.dsize - TIMEOUT_LEN));
 				
 		SAFE_FREE(databuf.dptr);
-		sscanf(entry_buf, CACHE_DATA_FMT, (int*)&t, v);
+		sscanf(entry_buf, CACHE_DATA_FMT, (int*)&i, v);
 		SAFE_FREE(entry_buf);
+		t = i;
 
 		DEBUG(10, ("Returning %s cache entry: key = %s, value = %s, "
 			   "timeout = %s\n", t > time(NULL) ? "valid" :
@@ -307,6 +309,7 @@
 	TDB_DATA databuf;
 	char *keystr = NULL, *valstr = NULL, *entry = NULL;
 	time_t timeout = 0;
+	unsigned i;
 
 	/* fail completely if get null pointers passed */
 	SMB_ASSERT(fn && keystr_pattern);
@@ -335,7 +338,8 @@
 		entry = strndup(databuf.dptr, databuf.dsize);
 		SAFE_FREE(databuf.dptr);
 		valstr = (char*)malloc(sizeof(char) * (databuf.dsize - TIMEOUT_LEN));
-		sscanf(entry, CACHE_DATA_FMT, (int*)(&timeout), valstr);
+		sscanf(entry, CACHE_DATA_FMT, (int*)(&i), valstr);
+		timeout = i;
 		
 		DEBUG(10, ("Calling function with arguments (key = %s, value = %s, timeout = %s)\n",
 		           keystr, valstr, ctime(&timeout)));



More information about the samba-cvs mailing list