# HG changeset patch # User Eric Warmenhoven # Date 1002650466 0 # Node ID 1b507a97b824608617f74c25dc661b8c841067e4 # Parent e6fc7d36689b05a384afac5c7709b465bc165479 [gaim-migrate @ 2470] stupid, stupid diff -r e6fc7d36689b -r 1b507a97b824 src/gtkspell.c --- a/src/gtkspell.c Tue Oct 09 16:23:08 2001 +0000 +++ b/src/gtkspell.c Tue Oct 09 18:01:06 2001 +0000 @@ -354,12 +354,11 @@ if (iswordsep(GTK_TEXT_INDEX(gtktext, end))) break; } - if (buf) { - char *tmp = g_malloc(end - start + 1); + if (buf && (end - start + 1 > 0)) { + *buf = g_malloc(end - start + 1); for (pos = start; pos < end; pos++) - tmp[pos-start] = GTK_TEXT_INDEX(gtktext, pos); - tmp[pos-start] = 0; - *buf = tmp; + (*buf)[pos-start] = GTK_TEXT_INDEX(gtktext, pos); + (*buf)[pos-start] = 0; } if (pstart) *pstart = start;