From 11fdb4b6171ae5a389bd7c25927b6431e5bc6d5f Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 17 Nov 2004 11:02:28 +0000 Subject: [PATCH] Use SAFEPRINTF macros in DESCRIBE_COMPILER macro to avoid buffer overflow. --- src/xpdev/genwrap.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/xpdev/genwrap.h b/src/xpdev/genwrap.h index e5055140dd..e366a73f73 100644 --- a/src/xpdev/genwrap.h +++ b/src/xpdev/genwrap.h @@ -76,40 +76,40 @@ extern "C" { /* Compiler Description */ #if defined(__BORLANDC__) - #define DESCRIBE_COMPILER(str) sprintf(str,"BCC %X.%02X" \ + #define DESCRIBE_COMPILER(str) SAFEPRINTF2(str,"BCC %X.%02X" \ ,__BORLANDC__>>8,__BORLANDC__&0xff); #elif defined(_MSC_VER) - #define DESCRIBE_COMPILER(str) sprintf(str,"MSC %u", _MSC_VER); + #define DESCRIBE_COMPILER(str) SAFEPRINTF(str,"MSC %u", _MSC_VER); #elif defined(__GNUC__) && defined(__VERSION__) - #define DESCRIBE_COMPILER(str) sprintf(str,"GCC %s", __VERSION__); + #define DESCRIBE_COMPILER(str) SAFEPRINTF(str,"GCC %s", __VERSION__); #elif defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) - #define DESCRIBE_COMPILER(str) sprintf(str,"GCC %u.%u.%u" \ + #define DESCRIBE_COMPILER(str) SAFEPRINTF3(str,"GCC %u.%u.%u" \ ,__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__); #elif defined(__GNUC__) && defined(__GNUC_MINOR__) - #define DESCRIBE_COMPILER(str) sprintf(str,"GCC %u.%u" \ + #define DESCRIBE_COMPILER(str) SAFEPRINTF2(str,"GCC %u.%u" \ ,__GNUC__,__GNUC_MINOR__); #elif defined(__WATCOMC__) - #define DESCRIBE_COMPILER(str) sprintf(str,"WATC %d" \ + #define DESCRIBE_COMPILER(str) SAFEPRINTF(str,"WATC %d" \ ,__WATCOMC__); #elif defined(__DMC__) /* Digital Mars C/C++ */ - #define DESCRIBE_COMPILER(str) sprintf(str,"DMC %X.%02X" \ + #define DESCRIBE_COMPILER(str) SAFEPRINTF(str,"DMC %X.%02X" \ ,__DMC__>>8,__DMC__&0xff); #else /* Unknown compiler */ - #define DESCRIBE_COMPILER(str) strcpy(str,"UNKNOWN COMPILER"); + #define DESCRIBE_COMPILER(str) SAFECOPY(str,"UNKNOWN COMPILER"); #endif -- GitLab