Package: readseq / 1-15

fix-gets.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Description: fix gets invocations.
 gets(3) manual page explicitly mentions to not make use of this function
 anymore.  This patch replaces their invocations to fgets instead, with a
 hardcoded size allocation.  This is not pretty perhaps, but way better than
 the unbound gets invocations.

Author: Étienne Mollier <emollier@debian.org>
Bug-Debian: https://bugs.debian.org/1066478
Forwarded: no
Last-Update: 2024-03-14
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- readseq.orig/readseq.c
+++ readseq/readseq.c
@@ -798,7 +798,7 @@
   if (askout && !closeout && !quietly) {
     askout = false;
     fprintf(stderr,"\nName of output file (?=help, defaults to display): \n");
-    gets(oname= onamestore);
+    fgets(oname= onamestore, 127, stdin);
     skipwhitespace(oname);
     if (*oname == '?') { usage(); exit_main(0); }
     else if (*oname != 0) {
@@ -862,7 +862,7 @@
       fprintf(stderr,"\nName an input sequence or -option: \n");
       inputfile= inputfilestore;
 
-      gets(stemp= stempstore);
+      fgets(stemp= stempstore, 127, stdin);
       if (*stemp==0) goto fini;  /* !! need this to finish work during interactive use */
       stemp= strtok(stempstore, " \n\r\t");
       while (stemp) {
@@ -908,7 +908,7 @@
       else if (whichSeq > nseq || !quietly) {
         dumpSeqList(seqlist, format);
         fprintf(stderr,"\nChoose a sequence (# or All): \n");
-        gets(stemp= stempstore);
+        fgets(stemp= stempstore, 127, stdin);
         skipwhitespace(stemp);
         if (to_lower(*stemp) == 'a') {
           chooseall= true;