]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
cal: fix -y output for UTF8
authorKarel Zak <kzak@redhat.com>
Mon, 17 Jun 2013 16:08:01 +0000 (18:08 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 17 Jun 2013 16:14:51 +0000 (18:14 +0200)
... in the yearly() function is a static buffer where is not space for
multibyte headers.

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/cal.c

index 276148db6317e5eb78d452a620bab9e4d2b2c42d..1eeeea8a0afee794bb5236ee54913f400dd33487 100644 (file)
@@ -598,7 +598,10 @@ void
 yearly(int day, int year) {
        int col, *dp, i, month, row, which_cal;
        int days[12][MAXDAYS];
-       char *p, lineout[100];
+       char *p;
+       char lineout[ sizeof(day_headings) + 2 +
+                     sizeof(day_headings) + 2 +
+                     sizeof(day_headings) + 1 ];
 
        snprintf(lineout, sizeof(lineout), "%d", year);
        center(lineout, WEEK_LEN*3 + HEAD_SEP*2 - 1, 0);