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);
*/
|