[Gnucash-changes] r13894 - gnucash/trunk - Bug#340358: mem/string-handling crasher fix.

Joshua Sled jsled at cvs.gnucash.org
Mon May 1 20:11:51 EDT 2006


Author: jsled
Date: 2006-05-01 20:11:49 -0400 (Mon, 01 May 2006)
New Revision: 13894
Trac: http://svn.gnucash.org/trac/changeset/13894

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/register/register-gnome/pricecell-gnome.c
Log:
Bug#340358: mem/string-handling crasher fix.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-05-01 08:00:10 UTC (rev 13893)
+++ gnucash/trunk/ChangeLog	2006-05-02 00:11:49 UTC (rev 13894)
@@ -1,3 +1,9 @@
+2006-05-01  Joshua Sled  <jsled at asynchronous.org>
+
+	* src/register/register-gnome/pricecell-gnome.c
+	(gnc_price_cell_direct_update): null-terminate strings we traffic
+	in, leading to less crashes! :( Bug#340358.
+
 2006-04-30  David Hampton  <hampton at employees.org>
 
 	* src/gnome/reconcile-list.c: Patch from Mike Alexander to fix the

Modified: gnucash/trunk/src/register/register-gnome/pricecell-gnome.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/pricecell-gnome.c	2006-05-01 08:00:10 UTC (rev 13893)
+++ gnucash/trunk/src/register/register-gnome/pricecell-gnome.c	2006-05-02 00:11:49 UTC (rev 13894)
@@ -127,7 +127,8 @@
     end = MAX(*start_selection, *end_selection);
 
     /* length in bytes, not chars. do not use g_utf8_strlen. */
-    buf = malloc(strlen(bcell->value));
+    buf = malloc(strlen(bcell->value)+1);
+    memset(buf, 0, strlen(bcell->value)+1);
     g_utf8_strncpy(buf, bcell->value, start);
     g_string_append(newval_gs, buf);
     g_free(buf);



More information about the gnucash-changes mailing list