[comp.sources.bugs] vmail - bug and fix

jz@mulga.oz (Justin Zobel) (10/19/87)

Last week's posting of vmail contained a bug w.r.t a boundary condition
in a loop.  Following is a fix.  (Those hardwired numbers shouldn't have
been there at all ... they crept in while I was trying to understand the
peculiar stack allocation on our Perkin-Elmer.  Thanks to Steve Schlaifer
and others who noticed this bug.)

Diffs are:

*** load.c.orig	Fri Oct 16 11:09:58 1987
--- load.c	Fri Oct 16 11:09:42 1987
***************
*** 226,232 ****
  		}
  	}
  	if(s != (char *) NULL) {
! 		for(i=0 ; i < 50 && fgets(str, LEN, fp) != (char *) NULL ;) {
  			str[strlen(str)-1] = ' ';
  			strncpy(fill+i, str, 42-i);
  			i += strlen(str);
--- 226,232 ----
  		}
  	}
  	if(s != (char *) NULL) {
! 		for(i=0 ; i < 42 && fgets(str, LEN, fp) != (char *) NULL ;) {
  			str[strlen(str)-1] = ' ';
  			strncpy(fill+i, str, 42-i);
  			i += strlen(str);