[comp.sources.bugs] Bug found in vcal

tombre@loria.crin.fr (Karl Tombre) (05/31/89)

I found what I firmly believe is a bug in vcal, written by Mike Essex
and distributed in comp.sources.whatever some time ago.

Maybe this problem was already mentioned ; in that case I missed the article.

Here is a context diff. The bug is quite obvious, and does strange
things to message number 79 in the appointments file.

*** vcal.c~	Wed May 31 11:58:30 1989
--- vcal.c	Wed May 31 12:19:39 1989
***************
*** 802,808
  	    tmpbuf[k] = NULL;
  	    msgdata[i] = malloc(80);
  	    strncpy(msgdata[i],tmpbuf,80);
! 	    msgdata[79] = NULL;
  
  	    if (i >= maxentries) {
  		printf("Warning:  Over 1000 entries in data file.  Data truncated.\n");

--- 802,808 -----
  	    tmpbuf[k] = NULL;
  	    msgdata[i] = malloc(80);
  	    strncpy(msgdata[i],tmpbuf,80);
! 	    msgdata[i][79] = NULL;
  
  	    if (i >= maxentries) {
  		printf("Warning:  Over 1000 entries in data file.  Data truncated.\n");

-- 
--- Karl Tombre @ CRIN / INRIA Lorraine
EMAIL : tombre@loria.crin.fr - POST : BP 239, 54506 VANDOEUVRE CEDEX, France