summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2023-12-26 03:29:40 +0100
committerSlávek Banko <[email protected]>2023-12-26 04:01:49 +0100
commita9d178f1000475ba1727ffe123a2c54585488c01 (patch)
tree99ce42ab68bfabc20f49dd0038c76a3f5d64fb32
parentfd6c582f15723514abc973aef946c1dfd895e7e2 (diff)
downloadtqt3-a9d178f1000475ba1727ffe123a2c54585488c01.tar.gz
tqt3-a9d178f1000475ba1727ffe123a2c54585488c01.zip
Fix potential buffer overflow in debug functions.
This resolves issue #70. Signed-off-by: Slávek Banko <[email protected]>
-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 8c8c82ac6..3a3317915 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