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

Derek Atkins warlord at MIT.EDU
Mon May 1 21:45:25 EDT 2006


Josh,

Quoting Joshua Sled <jsled at cvs.gnucash.org>:

>     /* 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);

Umm, this is problematic -- malloc() and then g_free()???  We should
use either malloc()/free(), or g_malloc()/g_free()...

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list