From 4d64bd7e66947ba5dee280c59f8950a8bba6cff8 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Fri, 9 Feb 2001 07:10:27 +0000 Subject: [PATCH] Added UPX_VERSION_STRING4, so that the size of the stubs is not affected by versions like "x.yy.zz beta". committer: mfx 981702627 +0000 --- doc/Makefile | 2 +- src/main.cpp | 4 ++++ src/packer.cpp | 5 ++--- src/version.h | 5 +++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 1238b77a..96ffbf8d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -4,7 +4,7 @@ top_srcdir = .. PACKAGE = upx VERSION_DATE = 04 Jan 2001 -VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING.*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h) +VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h) TRIMSPACE = cat TRIMSPACE = sed -e 's/ *$$//' diff --git a/src/main.cpp b/src/main.cpp index 4416d47f..4fc1942d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1019,6 +1019,10 @@ void upx_sanity_check(void) COMPILE_TIME_ASSERT(sizeof(align_assertion_2a_t) == sizeof(align_assertion_2b_t)); COMPILE_TIME_ASSERT(sizeof(align_assertion_1a_t) == 3*9); COMPILE_TIME_ASSERT(sizeof(align_assertion_2a_t) == 3*17); + + COMPILE_TIME_ASSERT(sizeof(UPX_VERSION_STRING4) == 4 + 1); + assert(strlen(UPX_VERSION_STRING4) == 4); + assert(memcmp(UPX_VERSION_STRING4, UPX_VERSION_STRING, 4) == 0); } diff --git a/src/packer.cpp b/src/packer.cpp index 24eafb05..02de2b89 100644 --- a/src/packer.cpp +++ b/src/packer.cpp @@ -816,8 +816,7 @@ int Packer::patchVersion(void *b, int blen) checkPatch(b, blen, boff, 14); unsigned char *p = (unsigned char *)b + boff + 9; - memset(p, ' ', 4); - memcpy(p, UPX_VERSION_STRING, UPX_MIN(strlen(UPX_VERSION_STRING), 4)); + memcpy(p, UPX_VERSION_STRING4, 4); return boff; } @@ -929,7 +928,7 @@ char const *Packer::identstr(unsigned &size) "\n\0" "$Info: This file is packed with the UPX executable packer http://upx.tsx.org $" "\n\0" - "$Id: UPX " UPX_VERSION_STRING " Copyright (C) 1996-2001 the UPX Team. All Rights Reserved. $" + "$Id: UPX " UPX_VERSION_STRING4 " Copyright (C) 1996-2001 the UPX Team. All Rights Reserved. $" "\n"; static const char identsmall[] = diff --git a/src/version.h b/src/version.h index 55f7e550..5fbb5622 100644 --- a/src/version.h +++ b/src/version.h @@ -1,3 +1,4 @@ -#define UPX_VERSION 0x011102 /* 01.11.02 */ -#define UPX_VERSION_STRING "1.11.2" +#define UPX_VERSION 0x011103 /* 01.11.03 */ +#define UPX_VERSION_STRING "1.11.3" +#define UPX_VERSION_STRING4 "1.11" #define UPX_VERSION_DATE "Jan 4th 2001"