Browse code

fix CL_ENGINE_DB_TIME, time_t may well be 64-bits, so writing only 32-bits will leave upper 32-bits undefined and lead to funny results, such as VERSION command working first time, but 2nd time not showing the DB timestamp.

git-svn: trunk@4637

Török Edvin authored on 2009/01/23 20:12:44
Showing 3 changed files
... ...
@@ -1,3 +1,11 @@
1
+Fri Jan 23 13:33:18 EET 2009 (edwin)
2
+------------------------------------
3
+ * libclamav/clamav.h, libclamav/others.c, libclamav/others.h: fix
4
+ CL_ENGINE_DB_TIME, time_t may well be 64-bits, so writing only
5
+ 32-bits will leave upper 32-bits undefined and lead to funny
6
+ results, such as VERSION command working first time, but 2nd time
7
+ not showing the DB timestamp.
8
+
1 9
 Thu Jan 22 15:59:43 CET 2009 (tk)
2 10
 ---------------------------------
3 11
  * clamconf: handle --version/-V
... ...
@@ -119,7 +119,7 @@ enum cl_engine_field {
119 119
     CL_ENGINE_MIN_SSN_COUNT,	    /* uint32_t */
120 120
     CL_ENGINE_PUA_CATEGORIES,	    /* (char *) */
121 121
     CL_ENGINE_DB_VERSION,	    /* uint32_t */
122
-    CL_ENGINE_DB_TIME,		    /* uint32_t */
122
+    CL_ENGINE_DB_TIME,		    /* time_t */
123 123
     CL_ENGINE_AC_ONLY,		    /* uint32_t */
124 124
     CL_ENGINE_AC_MINDEPTH,	    /* uint32_t */
125 125
     CL_ENGINE_AC_MAXDEPTH,	    /* uint32_t */
... ...
@@ -350,7 +350,8 @@ int cl_engine_get(const struct cl_engine *engine, enum cl_engine_field field, vo
350 350
 	    *((uint32_t *) val) = engine->dbversion[0];
351 351
 	    break;
352 352
 	case CL_ENGINE_DB_TIME:
353
-	    *((uint32_t *) val) = engine->dbversion[1];
353
+	    /* time_t may be 64-bit! */
354
+	    *((time_t *) val) = engine->dbversion[1];
354 355
 	    break;
355 356
 	case CL_ENGINE_AC_ONLY:
356 357
 	    *((uint32_t *) val) = engine->ac_only;