8685286568
Fixes an input validation error in extract_chmLib example program. Detailed information: http://secunia.com/advisories/20734/ "go for it" espie@
58 lines
1.8 KiB
Plaintext
58 lines
1.8 KiB
Plaintext
$OpenBSD: patch-src_chm_lib_c,v 1.4 2006/06/19 18:14:59 bernd Exp $
|
|
--- src/chm_lib.c.orig Mon Jun 19 16:29:18 2006
|
|
+++ src/chm_lib.c Mon Jun 19 16:31:50 2006
|
|
@@ -160,7 +160,8 @@ typedef unsigned __int64 UInt64;
|
|
/* Sparc */
|
|
/* MIPS */
|
|
/* PPC */
|
|
-#elif __i386__ || __sun || __sgi || __ppc__
|
|
+/* other non-64 bit */
|
|
+#elif !__LP64__
|
|
typedef unsigned char UChar;
|
|
typedef short Int16;
|
|
typedef unsigned short UInt16;
|
|
@@ -170,8 +171,8 @@ typedef long long Int64;
|
|
typedef unsigned long long UInt64;
|
|
|
|
/* x86-64 */
|
|
-/* Note that these may be appropriate for other 64-bit machines. */
|
|
-#elif __x86_64__ || __ia64__
|
|
+/* other 64-bit machines. */
|
|
+#else
|
|
typedef unsigned char UChar;
|
|
typedef short Int16;
|
|
typedef unsigned short UInt16;
|
|
@@ -179,11 +180,6 @@ typedef int Int32;
|
|
typedef unsigned int UInt32;
|
|
typedef long Int64;
|
|
typedef unsigned long UInt64;
|
|
-
|
|
-#else
|
|
-
|
|
-/* yielding an error is preferable to yielding incorrect behavior */
|
|
-#error "Please define the sized types for your platform in chm_lib.c"
|
|
#endif
|
|
|
|
/* GCC */
|
|
@@ -733,7 +729,7 @@ static Int64 _chm_fetch_bytes(struct chm
|
|
#ifdef CHM_USE_IO64
|
|
readLen = pread64(h->fd, buf, (long)len, os);
|
|
#else
|
|
- readLen = pread(h->fd, buf, (long)len, (unsigned int)os);
|
|
+ readLen = pread(h->fd, buf, (size_t)len, (off_t)os);
|
|
#endif
|
|
#else
|
|
#ifdef CHM_USE_IO64
|
|
@@ -743,9 +739,9 @@ static Int64 _chm_fetch_bytes(struct chm
|
|
lseek64(h->fd, oldOs, SEEK_SET);
|
|
#else
|
|
oldOs = lseek(h->fd, 0, SEEK_CUR);
|
|
- lseek(h->fd, (long)os, SEEK_SET);
|
|
+ lseek(h->fd, (off_t)os, SEEK_SET);
|
|
readLen = read(h->fd, buf, len);
|
|
- lseek(h->fd, (long)oldOs, SEEK_SET);
|
|
+ lseek(h->fd, (off_t)oldOs, SEEK_SET);
|
|
#endif
|
|
#endif
|
|
#endif
|