From 6d64e78dc55a805a38137d11c0bf7f673737fb93 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:30:00 -0700 Subject: [PATCH] Undo NULL file protection in 1990/dds As part of the redefinition of INABIAF the NULL file protection was removed. The bus error fix, the erroneous prototype to fopen() and the fgets() fix are still applied as these allow the entry to work properly (and without an obnoxious warning at compile, linking or runtime about gets()). --- 1990/dds/README.md | 2 +- 1990/dds/dds.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/1990/dds/README.md b/1990/dds/README.md index f1bb03903..3fbe8b5a5 100644 --- a/1990/dds/README.md +++ b/1990/dds/README.md @@ -16,7 +16,7 @@ you Yusuke! [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) removed the erroneous prototype to `fopen()` and made this use `fgets()` instead of `gets()` to make -it safer. He also fixed a segfault in the case that the file cannot be loaded. +it safer and to prevent a potentially alarming warning at linking or runtime. Thank you Cody for your assistance! ## To run diff --git a/1990/dds/dds.c b/1990/dds/dds.c index b615faeb5..a7585e669 100644 --- a/1990/dds/dds.c +++ b/1990/dds/dds.c @@ -17,7 +17,7 @@ X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?fgets(p=B,R,stdin),P[*d]=S():(*(q=Q(B,"TH ()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i =B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[ *B]=S();l++;}X'L':N printf(I)X'N':N(free(m[i]),0),m[i]=0 X'B':_ 0 t('S',5,"w",N -f&&fprintf(f,I))t('O',4,"r",while(f&&fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G() +fprintf(f,I))t('O',4,"r",while(fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G() ;}_ 0;}G(){l=atoi(B);m[l]&&(free(m[l]),0);(p=Q(B," "))?strcpy(m[l]=malloc(strlen(p )),p+1):(m[l]=0,0);}O(S,J,'=',==,'#',!=)O(J,K,'<',<,'>',>)O(K,V,'$',<=,'!',>=) O(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p<=