Package: dbskkd-cdb
Version: 1:1.01-13
Severity: important
Tags: patch

In uint32.h, uint32 is defined as follows.
=====================================================================
typedef unsigned long uint32;
=====================================================================
But in many 64bit system (like amd64), long is 64bit integer.

And in dbskkd-cdb.c, the pointer to uint32 (defined as unsigned long) is
passed as a pointer to unsigned int.

=====================================================================
  uint32 datalen;
...
      get_status = cdb_seek(jisho_fd, key, keylen, &datalen);
=====================================================================

In LP64 system, latter half of variable ``datalen'' will be not initialized.
So datalen may have very big value greater than 1UL<<32.

diff -Nru dbskkd-cdb-1.01.orig/cdb.h dbskkd-cdb-1.01/cdb.h
--- dbskkd-cdb-1.01.orig/cdb.h  1998-10-22 14:42:09.000000000 +0900
+++ dbskkd-cdb-1.01/cdb.h       1970-01-01 09:00:00.000000000 +0900
@@ -1,12 +0,0 @@
-#ifndef CDB_H
-#define CDB_H
-
-#include "uint32.h"
-
-extern uint32 cdb_hash();
-extern uint32 cdb_unpack();
-
-extern int cdb_bread();
-extern int cdb_seek();
-
-#endif
diff -Nru dbskkd-cdb-1.01.orig/dbskkd-cdb.c dbskkd-cdb-1.01/dbskkd-cdb.c
--- dbskkd-cdb-1.01.orig/dbskkd-cdb.c   1999-09-28 21:14:47.000000000 +0900
+++ dbskkd-cdb-1.01/dbskkd-cdb.c        2005-11-18 22:12:58.657122578 +0900
@@ -72,7 +72,7 @@
 #include <signal.h>
 #include <limits.h>
 #include <syslog.h>
-#include "cdb.h"
+#include <cdb.h>
 
 /* architectural dependencies */
 
@@ -149,7 +149,7 @@
   register unsigned char *pbuf, *key, *p;
   int length, errcode, get_status;
   unsigned int keylen;
-  uint32 datalen;
+  unsigned datalen;
 
   length = read(STDIN, &combuf[0], BUFSIZE - 1);
   if (length < 0) {
diff -Nru dbskkd-cdb-1.01.orig/uint32.h dbskkd-cdb-1.01/uint32.h
--- dbskkd-cdb-1.01.orig/uint32.h       1998-10-22 14:42:09.000000000 +0900
+++ dbskkd-cdb-1.01/uint32.h    1970-01-01 09:00:00.000000000 +0900
@@ -1,6 +0,0 @@
-#ifndef UINT32_H
-#define UINT32_H
-
-typedef unsigned long uint32;
-
-#endif

Reply via email to