--- sbr/ORIG/m_getfld.c Mon Jul 14 08:16:49 1997 +++ sbr/m_getfld.c Fri Apr 10 16:16:42 1998 @@ -254,9 +254,23 @@ bp = sp = (unsigned char *) iob->_ptr - 1; j = (cnt = iob->_cnt+1) < i ? cnt : i; #endif +/* Modif [fm] while ((c = *bp++) != ':' && c != '\n' && --j >= 0) *cp++ = c; - +*/ + while ((c = *bp++) != ':' && c != '\n') { + *cp++ = c; + /* + * Test that the buffer is exhausted. Outside the test of the while + * in case the end of the buffer is the end of memory. *bp++ => Memory fault + */ + if (--j <= 0) { + bp++; /* To count the last caracter */ + c = '\0'; + break; + } + } +/* Fin Modif [fm] */ j = bp - sp; if ((cnt -= j) <= 0) { #ifdef LINUX_STDIO