Date: Mon, 22 Dec 1997 14:45:29 +0800 (CST) From: frankch@waru.life.nthu.edu.tw To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: ports/5361: Correct patch for biology/babel Message-ID: <199712220645.OAA15266@waru.life.nthu.edu.tw> Resent-Message-ID: <199712220710.XAA03950@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 5361 >Category: ports >Synopsis: patch-ab eliminate gets warning but breaks menu function >Confidential: yes >Severity: critical >Priority: high >Responsible: freebsd-ports >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Dec 21 23:10:01 PST 1997 >Last-Modified: >Originator: Frank Chen Hsiung Chan >Organization: Department of Life Science, National Tsing Hua University, Hsinchu, Taiwan >Release: FreeBSD 2.2.5-STABLE i386 >Environment: FreeBSD 2.2.5 STABLE >Description: The patch file patch-ab replace gets() with fgets() to eliminate run time warning regarding unsafe gets(). Yet the patch break menu functionality of babel. Thanks Tony Maher <tonym@angis.usyd.edu.au> for pointing me to this. >How-To-Repeat: >Fix: The following patch modify patches/patch-ab so that babel can working under menu mode. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx cut here xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx diff -ruN babel.orig/patches/patch-ab babel/patches/patch-ab --- babel.orig/patches/patch-ab Mon Dec 22 14:25:15 1997 +++ babel/patches/patch-ab Mon Dec 22 14:29:49 1997 @@ -1,5 +1,5 @@ ---- menus.c.orig Thu Dec 4 20:20:28 1997 -+++ menus.c Thu Dec 4 20:21:46 1997 +--- menus.c.orig Tue Jan 21 23:52:36 1997 ++++ menus.c Mon Dec 22 14:29:37 1997 @@ -63,9 +63,9 @@ } } @@ -26,12 +26,14 @@ if (strlen(OutputKeywords) < 1) strcpy(OutputKeywords,"KEYWORDS GO HERE"); } -@@ -167,7 +167,7 @@ +@@ -167,8 +167,8 @@ while (done == FALSE) { printf("Choice : "); - gets(choice_string); +- for (i = 0; i < (int) strlen(choice_string); i++) + fgets(choice_string, 99, stdin); - for (i = 0; i < (int) strlen(choice_string); i++) ++ for (i = 0; i < ((int) strlen(choice_string) - 1) ; i++) { if (!isdigit(choice_string[i])) + choice = 0; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx cut here xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712220645.OAA15266>