From nobody  Mon Dec 16 22:47:57 1996
Received: (from nobody@localhost)
          by freefall.freebsd.org (8.8.4/8.8.4) id WAA03988;
          Mon, 16 Dec 1996 22:47:57 -0800 (PST)
Message-Id: <199612170647.WAA03988@freefall.freebsd.org>
Date: Mon, 16 Dec 1996 22:47:57 -0800 (PST)
From: graphix@iastate.edu
To: freebsd-gnats-submit@freebsd.org
Subject: GNU Chess printing "gets() is unsafe" is annoying
X-Send-Pr-Version: www-1.0

>Number:         2231
>Category:       ports
>Synopsis:       GNU Chess printing "gets() is unsafe" is annoying
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    markm
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 16 22:50:01 PST 1996
>Closed-Date:    Mon Mar 3 10:32:49 PST 1997
>Last-Modified:  Mon Mar  3 10:33:50 PST 1997
>Originator:     Kent Vander Velden
>Release:        3.0-CURRENT
>Organization:
ISU
>Environment:
FreeBSD pseudo.cc.iastate.edu 3.0-CURRENT FreeBSD 3.0-CURRENT #0: Mon Dec  9 04:50:20 CST 1996     kent@pseudo.cc.iastate.edu:/usr/src/sys/compile/PSEUDO  i386

>Description:
It is at best annoying to have gnu chess (and xboard since
it reports the errors) print "gets() is unsafe".
>How-To-Repeat:
Run gnuchess :)
>Fix:
This patch will replace all gets() with appropiate fgets().
It is possible I assume that getstr() be implemented as
a macro using gets()... but I did not touch the getstr()
calls.


diff --exclude=config* --exclude=Makefile --minimal orig/gnuchess-4.0.pl77/src/d
spcom.c gnuchess-4.0.pl77/src/dspcom.c
1102c1102
<       (void) gets (sx);
---
>       (void) fgets (sx, 80, stdin);
1107c1107
<       eof = ( gets (sx) == NULL );
---
>       eof = ( fgets (sx, 80, stdin) == NULL );
diff --exclude=config* --exclude=Makefile --minimal orig/gnuchess-4.0.pl77/src/g
nuan.c gnuchess-4.0.pl77/src/gnuan.c
1350c1350
<     gets (infilename);
---
>     fgets (infilename, 255, stdin);
1355c1355
<         gets (inbuf);
---
>         fgets (inbuf, 256, stdin);
1371c1371
<         gets (inbuf);
---
>         fgets (inbuf, 256, stdin);
1381c1381
<     gets (inbuf);
---
>     fgets (inbuf, 256, stdin);
1561c1561
<                   gets (GNUANinbuf1);
---
>                   fgets (GNUANinbuf1, 128, stdin);
diff --exclude=config* --exclude=Makefile --minimal orig/gnuchess-4.0.pl77/src/n
ondsp.c gnuchess-4.0.pl77/src/nondsp.c
267c267
<   gets (s);                   /* skip "setup" command */
---
>   fgets (s, 80, stdin);                       /* skip "setup" command */
270c270
<       gets (s);
---
>       fgets (s, 80, stdin);
620c620
<       gets (T);
---
>       fgets (T, 64, stdin);
diff --exclude=config* --exclude=Makefile --minimal orig/gnuchess-4.0.pl77/src/n
uxdsp.c gnuchess-4.0.pl77/src/nuxdsp.c
939c939
<       gets (T);
---
>       fgets (T, 64, stdin);
diff --exclude=config* --exclude=Makefile --minimal orig/gnuchess-4.0.pl77/src/u
xdsp.c gnuchess-4.0.pl77/src/uxdsp.c
776c776
<    gets (T);
---
>    fgets (T, 64, stdin);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: asami 
State-Changed-When: Thu Jan 9 01:38:31 PST 1997 
State-Changed-Why:  
Sorry, can you re-submit the patches as context or unified diffs? 
Responsible-Changed-From-To: freebsd-ports->markm 
Responsible-Changed-By: asami 
Responsible-Changed-When: Thu Jan 9 01:59:57 PST 1997 
Responsible-Changed-Why:  
Your port, Mark. 
State-Changed-From-To: analyzed->feedback 
State-Changed-By: markm 
State-Changed-When: Mon Jan 20 12:49:37 PST 1997 
State-Changed-Why:  
I'd like to commit your fixes, but the default diff format you've 
used is quite buggy and difficult to use safely in a patch. Please 
redo the diff with "diff -c" or "diff -u" and resubmit. 

Thanks! 

M 
State-Changed-From-To: feedback->closed 
State-Changed-By: markm 
State-Changed-When: Mon Mar 3 10:32:49 PST 1997 
State-Changed-Why:  
Patch applied. Thanks! 

M 
>Unformatted:
