Bug#340358: mem/string-handling crasher fix.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13894 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled 2006-05-02 00:11:49 +00:00
parent fd3164b629
commit 014a0bf8a2
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2006-05-01 Joshua Sled <jsled@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@employees.org>
* src/gnome/reconcile-list.c: Patch from Mike Alexander to fix the

View File

@ -127,7 +127,8 @@ gnc_price_cell_direct_update (BasicCell *bcell,
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);