summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2023-12-26 03:29:40 +0100
committerSlávek Banko <slavek.banko@axis.cz>2023-12-26 09:44:27 +0100
commit1c30858477bcf3a4c74866d9a3d26f57753dd36a (patch)
tree88a2db1c2eb24c3f6a2324aab64f04228316132a
parentf30ac87a4f8f5f7ee6df01c4d9e6605de908d9f5 (diff)
downloadtqt3-1c30858477bcf3a4c74866d9a3d26f57753dd36a.tar.gz
tqt3-1c30858477bcf3a4c74866d9a3d26f57753dd36a.zip
Fix potential buffer overflow in debug functions.
This resolves issue #70. Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit a9d178f1000475ba1727ffe123a2c54585488c01)
-rw-r--r--src/tools/qglobal.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/qglobal.cpp b/src/tools/qglobal.cpp
index ed8805291..006037241 100644
--- a/src/tools/qglobal.cpp
+++ b/src/tools/qglobal.cpp
@@ -520,7 +520,7 @@ void tqDebug( const char *msg, ... )
va_list ap;
va_start( ap, msg ); // use variable arg list
#if defined(QT_VSNPRINTF)
- QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH, msg, ap );
+ QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH-len, msg, ap );
#else
vsprintf( &buf[len], msg, ap );
#endif
@@ -555,7 +555,7 @@ void tqWarning( const char *msg, ... )
va_list ap;
va_start( ap, msg ); // use variable arg list
#if defined(QT_VSNPRINTF)
- QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH, msg, ap );
+ QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH-len, msg, ap );
#else
vsprintf( &buf[len], msg, ap );
#endif
@@ -590,7 +590,7 @@ void tqFatal( const char *msg, ... )
va_list ap;
va_start( ap, msg ); // use variable arg list
#if defined(QT_VSNPRINTF)
- QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH, msg, ap );
+ QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH-len, msg, ap );
#else
vsprintf( &buf[len], msg, ap );
#endif