File: mayhem.patch

package info (click to toggle)
gff2aplot 2.0-14
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,572 kB
  • sloc: perl: 5,378; ansic: 806; makefile: 121; javascript: 93; sh: 41
file content (38 lines) | stat: -rw-r--r-- 1,064 bytes parent folder | download | duplicates (5)
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
Author: Andreas Tille <tille@debian.org>
Last-Update: Sun, 13 Dec 2015 19:13:06 +0100
Bug-Debian: https://bugs.debian.org/715627
Description: Deal with Mayhem issue

--- a/src/ali2gff/ali2gff.c
+++ b/src/ali2gff/ali2gff.c
@@ -93,7 +93,7 @@ int main(int argc,  char *argv[]) {
 	strcpy(prgCall,argv[0]);
 	if (argc < 2) printUsage();
 	
-	while (argv[1][0] == '-') {
+	while (argv[1] && argv[1][0] == '-') {
 		switch (argv[1][1]) {
 			case 't':
 				opt_t = 1;
@@ -128,7 +128,11 @@ int main(int argc,  char *argv[]) {
 		argv++;	/* move the pointer to the right */
 	}
 	if (argc > 2) printUsage();
-	strcpy(infile,argv[1]);
+	if (!argv[1]) {
+             fprintf(stderr, "Missing file name");
+             printUsage();
+        }
+	strncpy(infile,argv[1],MAXSTRING);
 
 	/*----- choose output channel ----*/
 	if (opt_f) {
@@ -136,7 +140,7 @@ int main(int argc,  char *argv[]) {
 		fileptr = strrchr(infile,'/');
 		if (fileptr == NULL)
 		*/	
-			strcpy(outfile,infile);
+			strncpy(outfile,infile,MAXSTRING );
 		/*
 		else strcpy(outfile,++fileptr);
 		*/