diff --git a/1994/schnitzi/README.md b/1994/schnitzi/README.md index e7733f2dc..0f45cd400 100644 --- a/1994/schnitzi/README.md +++ b/1994/schnitzi/README.md @@ -14,11 +14,15 @@ ./schnitzi < textfile -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed the entry to not -overflow the buffer (and segfault) by changing the call of `gets()` to -`fgets()`. He also increased the buffer size. Prior to this fix one could not -redirect the Makefile into this program, as an example problem. Thank you Cody -for your assistance! +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) increased the buffer +size from 100 to 10000. Changing it to use `fgets()` instead of `gets()` is more +problematic because when feeding the source code to the program the output +results in compiler errors and not only that but the gets() is still there in +the generated output. Even changing the buffer size can result in compilation +errors if not done correctly. The generated output also does not have a changed +buffer size. Changing it to use fgets() can happen later, maybe, but bigger +files can now be parsed by the original code. An example is this Makefile. Thank +you Cody! ## Try: diff --git a/1994/schnitzi/schnitzi.c b/1994/schnitzi/schnitzi.c index 2b1440fd5..a28d79ee9 100644 --- a/1994/schnitzi/schnitzi.c +++ b/1994/schnitzi/schnitzi.c @@ -20,12 +20,12 @@ h mh111 de{l) +di (+'( d+% c n+ */ n = 0 ; main ( ) { char v [ - 1000 ] , s; - int t[100 ] , - u[100 ] ; u + 10000 ] , s; + int t[100 ] , + u[100 ] ; u [ 0 ]=ftell(stdin ) ; - while(fgets(v,100,stdin )&&((v[strlen(v)-1]='\0',1)) ) + while(gets (v ) ) {t [ r ]= strlen ( v);y=