From: Ben Pfaff Date: Sun, 7 May 2006 05:26:03 +0000 (+0000) Subject: Fix segfault. X-Git-Tag: v0.6.0~881 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efe067379890a29af2b4ad06bf83df7a2eb4d009;p=pspp-builds.git Fix segfault. --- diff --git a/src/language/data-io/ChangeLog b/src/language/data-io/ChangeLog index dc6a346a..422e6a6c 100644 --- a/src/language/data-io/ChangeLog +++ b/src/language/data-io/ChangeLog @@ -1,3 +1,10 @@ +Sat May 6 22:25:09 2006 Ben Pfaff + + Fix segfault. + + * list.q (write_fallback_headers): (write_fallback_headers) + Properly record width of leader and pass it to write_varname(). + Sat May 6 19:03:13 2006 Ben Pfaff * get.c: (mtf_merge_dictionary) Fix value label memory leak. diff --git a/src/language/data-io/list.q b/src/language/data-io/list.q index d8df19cb..b1bb9aad 100644 --- a/src/language/data-io/list.q +++ b/src/language/data-io/list.q @@ -438,6 +438,7 @@ write_fallback_headers (struct outp_driver *d) while (index < cmd.n_variables) { struct outp_text text; + int leader_width; /* Ensure that there is enough room for a line of text. */ if (d->cp_y + d->font_height > d->length) @@ -452,7 +453,8 @@ write_fallback_headers (struct outp_driver *d) text.y = d->cp_y; text.h = text.v = INT_MAX; d->class->text_draw (d, &text); - d->class->text_metrics (d, &text, &d->cp_x, NULL); + d->class->text_metrics (d, &text, &leader_width, NULL); + d->cp_x = leader_width; goto entry; do @@ -473,9 +475,10 @@ write_fallback_headers (struct outp_driver *d) } { - char varname[10]; - sprintf (varname, " %s", cmd.v_variables[index]->name); - write_varname (d, varname, text.h); + char varname[LONG_NAME_LEN + 2]; + snprintf (varname, sizeof varname, + " %s", cmd.v_variables[index]->name); + write_varname (d, varname, leader_width); } } while (++index < cmd.n_variables);