Previously, the code to write variable labels to system files accidentally
padded out the variable labels on the right with spaces to a multiple of 4
bytes in length. With this commit, variable labels will no longer be
padded.
This fixes a genuine bug for variable labels longer than 252 bytes, which
previously were padded out to 256 bytes. Variable labels are limited to
a maximum of 255 bytes, so PSPP refused to read such files.
Reported-by: Robert Westlund <rob@kinesissurvey.com>
if (var_has_label (v))
{
const char *label = var_get_label (v);
- size_t padded_len = ROUND_UP (MIN (strlen (label), 255), 4);
- write_int (w, padded_len);
+ size_t label_len = MIN (strlen (label), 255);
+ size_t padded_len = ROUND_UP (label_len, 4);
+ write_int (w, label_len);
write_string (w, label, padded_len);
}