--- OLD/pbm/pbmtext.c Thu Jan 1 00:00:00 1970 +++ NEW/pbm/pbmtext.c Thu Jan 1 00:00:00 1970 @@ -105,10 +105,12 @@ else { /* Read text from stdin. */ lines = 0; - while ( gets( buf ) != NULL ) + while ( fgets( buf, sizeof(buf), stdin ) != NULL ) { int l; + l = strlen( buf ); + if ((l > 0) && (buf[l-1] == '\n')) buf[--l] = '\0'; fix_control_chars( buf ); l = strlen( buf ); if ( lines >= maxlines )