Subject: cal(1) bug fixes
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Christos Zoulas <christos@deshaw.com>
List: current-users
Date: 01/09/1994 14:51:23
Did not null terminate the strings, printing garbage...

christos

*** cal.c.dist	Fri Dec 17 02:04:58 1993
--- cal.c	Sun Jan  9 14:48:48 1994
***************
*** 200,205 ****
--- 200,206 ----
  		for (col = 0, p = lineout; col < 7; col++,
  		    p += julian ? J_DAY_LEN : DAY_LEN)
  			ascii_day(p, days[row * 7 + col]);
+ 		*p = '\0';
  		trim_trailing_spaces(lineout);
  		(void)printf("%s\n", lineout);
  	}
***************
*** 232,237 ****
--- 233,239 ----
  				for (col = 0; col < 7; col++, p += J_DAY_LEN)
  					ascii_day(p, *dp++);
  			}
+ 			*p = '\0';
  			trim_trailing_spaces(lineout);
  			(void)printf("%s\n", lineout);
  		}
***************
*** 267,272 ****
--- 269,275 ----
  				for (col = 0; col < 7; col++, p += DAY_LEN)
  					ascii_day(p, *dp++);
  			}
+ 			*p = '\0';
  			trim_trailing_spaces(lineout);
  			(void)printf("%s\n", lineout);
  		}

------------------------------------------------------------------------------