Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/giftrans-1.12.2/giftrans.c FINAL RESULTS: data/giftrans-1.12.2/giftrans.c:806:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). (void)strcpy(rgb,ptr); data/giftrans-1.12.2/giftrans.c:808:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). (void)strcat(rgb,rgbtxt); data/giftrans-1.12.2/giftrans.c:837:11: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). (void)strcpy((*next)->name=(char *)malloc(strlen(nptr)+1),nptr); data/giftrans-1.12.2/giftrans.c:845:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(error,"%s: cannot open %s",image,rgb); data/giftrans-1.12.2/giftrans.c:933:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(error,"%s: cannot open %s",image,oname); data/giftrans-1.12.2/giftrans.c:939:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(error,"%s: cannot open %s",image,ename); data/giftrans-1.12.2/giftrans.c:972:11: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(error,"%s: cannot open %s",image,argv[optind]); data/giftrans-1.12.2/giftrans.c:803:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. ptr=getenv("XFILES"); data/giftrans-1.12.2/giftrans.c:865:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c=getopt(argc,argv,"t:TB:b:g:c:ClLVDo:e:vh?")) != EOF) data/giftrans-1.12.2/giftrans.c:289:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char size,buffer[256]; data/giftrans-1.12.2/giftrans.c:311:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char size,buffer[256]; data/giftrans-1.12.2/giftrans.c:331:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char size,buffer[256]; data/giftrans-1.12.2/giftrans.c:362:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char size,buffer[256]; data/giftrans-1.12.2/giftrans.c:385:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buffer[3*256],lsd[7],gct[3*256],gce[5]; data/giftrans-1.12.2/giftrans.c:729:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). c->index=atoi(arg); data/giftrans-1.12.2/giftrans.c:797:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char error[2*MAXPATHLEN+14],line[BUFSIZ],*ptr,*nptr,*oname,*ename; data/giftrans-1.12.2/giftrans.c:815:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((src=fopen(rgb,"r"))!=NULL) { data/giftrans-1.12.2/giftrans.c:824:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). (*next)->red=atoi(nptr); data/giftrans-1.12.2/giftrans.c:828:20: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). (*next)->green=atoi(nptr); data/giftrans-1.12.2/giftrans.c:832:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). (*next)->blue=atoi(nptr); data/giftrans-1.12.2/giftrans.c:967:13: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((src=fopen(argv[optind],"rb"))!=NULL) { data/giftrans-1.12.2/giftrans.c:590:45: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). writedata(dest,(unsigned char *)comment,strlen(comment)); data/giftrans-1.12.2/giftrans.c:731:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(arg)==4) { data/giftrans-1.12.2/giftrans.c:737:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). else if (strlen(arg)==7) { data/giftrans-1.12.2/giftrans.c:805:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). rgb=(char *)malloc(strlen(ptr)+strlen(rgbtxt)+2); data/giftrans-1.12.2/giftrans.c:805:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). rgb=(char *)malloc(strlen(ptr)+strlen(rgbtxt)+2); data/giftrans-1.12.2/giftrans.c:807:9: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. (void)strcat(rgb,"\\"); data/giftrans-1.12.2/giftrans.c:837:47: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (void)strcpy((*next)->name=(char *)malloc(strlen(nptr)+1),nptr); ANALYSIS SUMMARY: Hits = 28 Lines analyzed = 984 in approximately 0.06 seconds (17544 lines/second) Physical Source Lines of Code (SLOC) = 773 Hits@level = [0] 98 [1] 7 [2] 12 [3] 2 [4] 7 [5] 0 Hits@level+ = [0+] 126 [1+] 28 [2+] 21 [3+] 9 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 163.001 [1+] 36.2225 [2+] 27.1669 [3+] 11.6429 [4+] 9.05563 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.