X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-data-store.c;h=7aa0ff339c94409e7b961c1e63aac61fd3d8e849;hb=ebccf00cbddbcadb5883fa98ddbccbea67642295;hp=0cb719046eab964b9a78dc584c628735019979da;hpb=f5eee9d8478b154444bb0eede53fb892b8130974;p=pspp-builds.git diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index 0cb71904..7aa0ff33 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -364,13 +364,18 @@ psppire_data_store_get_string(GSheetModel *model, gint row, gint column) fp = psppire_variable_get_write_spec(pv); - s = g_string_sized_new (fp->w); + s = g_string_sized_new (fp->w + 1); + g_string_set_size(s, fp->w); + + memset(s->str, 0, fp->w); + + g_assert(fp->w == s->len); /* Converts binary value V into printable form in the exactly FP->W character in buffer S according to format specification FP. No null terminator is appended to the buffer. */ data_out (s->str, fp, v); - + return g_string_free(s, FALSE); #if 0 {