Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Dec 1996 22:47:57 -0800 (PST)
From:      graphix@iastate.edu
To:        freebsd-gnats-submit@freebsd.org
Subject:   ports/2231: GNU Chess printing "gets() is unsafe" is annoying
Message-ID:  <199612170647.WAA03988@freefall.freebsd.org>
Resent-Message-ID: <199612170650.WAA04149@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2231
>Category:       ports
>Synopsis:       GNU Chess printing "gets() is unsafe" is annoying
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 16 22:50:01 PST 1996
>Last-Modified:
>Originator:     Kent Vander Velden
>Organization:
ISU
>Release:        3.0-CURRENT
>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);

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612170647.WAA03988>