فهرست منبع

UI: Address logging buffer size discrepancies

jcm 1 سال پیش
والد
کامیت
bd36daa395
3فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 3 2
      UI/obs-app.cpp
  2. 1 1
      UI/qt-wrappers.cpp
  3. 1 1
      libobs/util/base.c

+ 3 - 2
UI/obs-app.cpp

@@ -350,7 +350,7 @@ static inline bool too_many_repeated_entries(fstream &logFile, const char *msg,
 	static mutex log_mutex;
 	static const char *last_msg_ptr = nullptr;
 	static int last_char_sum = 0;
-	static char cmp_str[4096];
+	static char cmp_str[8192];
 	static int rep_count = 0;
 
 	int new_sum = sum_chars(output_str);
@@ -376,7 +376,8 @@ static inline bool too_many_repeated_entries(fstream &logFile, const char *msg,
 	}
 
 	last_msg_ptr = msg;
-	strcpy(cmp_str, output_str);
+	strncpy(cmp_str, output_str, sizeof(cmp_str));
+	cmp_str[sizeof(cmp_str) - 1] = 0;
 	last_char_sum = new_sum;
 	rep_count = 0;
 

+ 1 - 1
UI/qt-wrappers.cpp

@@ -42,7 +42,7 @@
 
 static inline void OBSErrorBoxva(QWidget *parent, const char *msg, va_list args)
 {
-	char full_message[4096];
+	char full_message[8192];
 	vsnprintf(full_message, sizeof(full_message), msg, args);
 
 	QMessageBox::critical(parent, "Error", full_message);

+ 1 - 1
libobs/util/base.c

@@ -27,7 +27,7 @@ static void *crash_param = NULL;
 static void def_log_handler(int log_level, const char *format, va_list args,
 			    void *param)
 {
-	char out[4096];
+	char out[8192];
 	vsnprintf(out, sizeof(out), format, args);
 
 	switch (log_level) {