Fix segfault in 1994/schnitzi - use fgets()

An example file that would cause the entry to crash is the Makefile. Now
it won't crash. Strangely without increasing the buffer size but even
using fgets() the Makefile did crash the entry. Changing the buffer size
is not a problem but whether or not some other larger file will cause a
problem or not I do not know. I don't see how it would but I don't see
how this happened either.
This commit is contained in:
Cody Boone Ferguson committed 2023-03-28 09:36:43 -07:00
1 parent c79aa3081c
commit 5bbdf553cc
2 files changed
+25 -11

No files matched your search

+4 -4
View File
@@ -20,12 +20,12 @@ h mh111 de{l) +di (+'( d+% c n+
*/ n = 0 ;
main ( ) {
char v [
100 ] , s;
int t[100 ] ,
u[100 ] ; u
1000 ] , s;
int t[100 ] ,
u[100 ] ; u
[ 0
]=ftell(stdin ) ;
while(gets (v ) )
while(fgets(v,100,stdin )&&((v[strlen(v)-1]='\0',1)) )
{t [ r ]=
strlen (
v);y=