Package: acedb / 4.9.39+dfsg.02-5

mayhem.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Author: Andreas Tille <tille@debian.org>
Last-Update: Sun, 13 Dec 2015 18:53:59 +0100
Bug-Debian: https://bugs.debian.org/715832
            https://bugs.debian.org/715860
Description: Fix crashes reported by Mayhem

--- a/w9/dotterMain.c
+++ b/w9/dotterMain.c
@@ -271,6 +271,11 @@ int main(int argc, char **argv)
 	case 'r': revcompq = 1;               break;
 	case 's': soffset = atoi(optarg);     break;
 	case 'S': 
+            if ( optind+4 >= argc ) {
+                fprintf(stderr,"Illegal number of command line arguments for option -S");
+                fprintf(stderr,"%s\n",usage);
+                exit(1);
+            }
 	    selfcall = 1;
 	    qname = messalloc(strlen(argv[optind])+1); strcpy(qname, argv[optind]);
 	    qlen = atoi(argv[optind+1]);
--- a/w9/efetch.c
+++ b/w9/efetch.c
@@ -37,8 +37,9 @@
 
 #include "dbidx.h"
 
+#define MAXFILE 128
 extern char dbsource[32];
-char  *env, dbdir[128]="", *seqName;
+char  *env, dbdir[MAXFILE]="", *seqName;
 int    wormpep2swiss = 0;
 
 void swissprot(void)
@@ -89,9 +90,9 @@ void prosite(void)
 void main(int argc, char *argv[])
 {
   FILE        *idx, *db, *actrg, *achit;
-  static char  idxfile[128]="", dbfile[128]="", divfile[128]="", 
-               actrgfile[128]="", achitfile[128]="", dbprefix[32]="";
-  static char *file, customName[128]="";
+  static char  idxfile[MAXFILE]="", dbfile[MAXFILE]="", divfile[MAXFILE]="", 
+               actrgfile[MAXFILE]="", achitfile[MAXFILE]="", dbprefix[32]="";
+  static char *file, customName[MAXFILE]="";
   char         query[32], *tmpstr, *cp, fetchstr[256]; 
   int          optc, pos, i;
   int          Startseq = -1, Endseq = -1;
@@ -216,14 +217,29 @@ void main(int argc, char *argv[])
   case 'f':
       fasta = 1; break;
   case 'i':
-      strcpy(idxfile, optarg); break;
+      if ( !optarg ) {
+          fprintf(stderr,"Missing idxfile for option -i.\n");
+          fprintf(stderr,"%s\n",helpText);
+          exit(1);
+      }
+      strncpy(idxfile, optarg, MAXFILE); break;
   case 'q':
       fasta = 1;
       seqonly = 1; break;
   case 'D':
-      strcpy(dbdir, optarg); break;
+      if ( !optarg ) {
+          fprintf(stderr,"Missing dir for option -D.\n");
+          fprintf(stderr,"%s\n",helpText);
+          exit(1);
+      }
+      strncpy(dbdir, optarg, MAXFILE); break;
   case 'd':
-      strcpy(dbfile, optarg); break;
+      if ( !optarg ) {
+          fprintf(stderr,"Missing dbfile for option -d.\n");
+          fprintf(stderr,"%s\n",helpText);
+          exit(1);
+      }
+      strncpy(dbfile, optarg, MAXFILE); break;
   case 'H':
       display_head=1; break;
   case 'h':
@@ -240,7 +256,12 @@ void main(int argc, char *argv[])
   case 'p':
       search = 1; break;
   case 'l':
-      strcpy(divfile, optarg); break;
+      if ( !optarg ) {
+          fprintf(stderr,"Missing divfile for option -l.\n");
+          fprintf(stderr,"%s\n",helpText);
+          exit(1);
+      }
+      strncpy(divfile, optarg, MAXFILE); break;
   case 's':
   case 'S':
       Startseq = atoi(optarg);
@@ -259,7 +280,12 @@ void main(int argc, char *argv[])
       Mini = 1;  /* Mini output format */
       fasta = 1;               break;
   case 'n':
-      strcpy(customName, optarg); break;
+      if ( !optarg ) {
+          fprintf(stderr,"Missing name for option -n.\n");
+          fprintf(stderr,"%s\n",helpText);
+          exit(1);
+      }
+      strncpy(customName, optarg, MAXFILE); break;
   case 'w':
       wormpep2swiss = 1;       break;
   case '-':