I recently tried to use Conglomerate again, and saw that this
bug still exists, so I fired up gdb and came up with this patch.

I am not a big fan of bugzilla (or yet another mailing list subscription), 
so I would be glad if someone else (Geert?) would take this upstream ;-)

cheers,
Christian Henz


Index: cong-location.c
===================================================================
--- cong-location.c	(revision 2141)
+++ cong-location.c	(working copy)
@@ -458,7 +458,15 @@
 		char_after_next = g_utf8_find_next_char(next_char, NULL);
 		if (char_after_next) {
 			CONG_VALIDATE_UTF8(char_after_next);
-			new_text = strcat (new_text, char_after_next);
+			// new_text = strcat (new_text, char_after_next);
+			// This does not work!!! new_text may not have space for appending!!!
+			// Rather build a new string from scratch...
+			size_t buffer_size = strlen( new_text ) + strlen( char_after_next ) + 1;
+			char* buffer = (char*)calloc(buffer_size, 1);
+			CONG_VALIDATE_UTF8(buffer);
+			snprintf(buffer, buffer_size, "%s%s", new_text, char_after_next );
+			g_free( new_text );
+			new_text = buffer;
 			CONG_VALIDATE_UTF8(new_text);
 		}
 

Reply via email to