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/giflib-5.2.1/dgif_lib.c Examining data/giflib-5.2.1/egif_lib.c Examining data/giflib-5.2.1/getarg.c Examining data/giflib-5.2.1/getarg.h Examining data/giflib-5.2.1/gif2rgb.c Examining data/giflib-5.2.1/gif_err.c Examining data/giflib-5.2.1/gif_font.c Examining data/giflib-5.2.1/gif_hash.c Examining data/giflib-5.2.1/gif_hash.h Examining data/giflib-5.2.1/gif_lib.h Examining data/giflib-5.2.1/gif_lib_private.h Examining data/giflib-5.2.1/gifalloc.c Examining data/giflib-5.2.1/gifbg.c Examining data/giflib-5.2.1/gifbuild.c Examining data/giflib-5.2.1/gifclrmp.c Examining data/giflib-5.2.1/gifcolor.c Examining data/giflib-5.2.1/gifecho.c Examining data/giflib-5.2.1/giffilter.c Examining data/giflib-5.2.1/giffix.c Examining data/giflib-5.2.1/gifhisto.c Examining data/giflib-5.2.1/gifinto.c Examining data/giflib-5.2.1/gifsponge.c Examining data/giflib-5.2.1/giftext.c Examining data/giflib-5.2.1/giftool.c Examining data/giflib-5.2.1/gifwedge.c Examining data/giflib-5.2.1/openbsd-reallocarray.c Examining data/giflib-5.2.1/qprintf.c Examining data/giflib-5.2.1/quantize.c FINAL RESULTS: data/giflib-5.2.1/gif2rgb.c:523:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/gif_font.c:240:8: [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(dup, (char *)legend); data/giflib-5.2.1/gifbg.c:97:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/gifbuild.c:61:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/gifclrmp.c:78:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/gifcolor.c:62:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/gifecho.c:78:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/giffix.c:62:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/gifhisto.c:80:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/gifinto.c:95:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/gifinto.c:131:5: [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). strcat(FoutTmpName, DEFAULT_TMP_NAME); data/giflib-5.2.1/gifinto.c:169:6: [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). strcat(DefaultName, DEFAULT_OUT_NAME); data/giflib-5.2.1/giftext.c:72:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/gifwedge.c:63:8: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)fprintf(stderr, VersionStr, GIFLIB_MAJOR, GIFLIB_MINOR); data/giflib-5.2.1/qprintf.c:31:8: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. (void)vsnprintf(Line, sizeof(Line), Format, ArgPtr); data/giflib-5.2.1/giftool.c:115:22: [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 ((status = getopt(argc, argv, "a:b:d:f:i:n:p:s:u:x:")) != EOF) data/giflib-5.2.1/dgif_lib.c:61:23: [2] (misc) open: 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 ((FileHandle = open(FileName, O_RDONLY)) == -1) { data/giflib-5.2.1/dgif_lib.c:79:5: [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 Buf[GIF_STAMP_LEN + 1]; data/giflib-5.2.1/dgif_lib.c:167:5: [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 Buf[GIF_STAMP_LEN + 1]; data/giflib-5.2.1/dgif_lib.c:460:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&sp->ImageDesc, &GifFile->Image, sizeof(GifImageDesc)); data/giflib-5.2.1/dgif_lib.c:729:14: [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 c[2]; data/giflib-5.2.1/egif_lib.c:70:22: [2] (misc) open: 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). FileHandle = open(FileName, O_WRONLY | O_CREAT | O_EXCL, data/giflib-5.2.1/egif_lib.c:73:22: [2] (misc) open: 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). FileHandle = open(FileName, O_WRONLY | O_CREAT | O_TRUNC, data/giflib-5.2.1/egif_lib.c:831:14: [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 c[2]; data/giflib-5.2.1/getarg.c:130:27: [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. static int GATestAllSatis(char *CtrlStrCopy, char *CtrlStr, char **argv_end, data/giflib-5.2.1/getarg.c:130:46: [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. static int GATestAllSatis(char *CtrlStrCopy, char *CtrlStr, char **argv_end, data/giflib-5.2.1/getarg.c:130:61: [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. static int GATestAllSatis(char *CtrlStrCopy, char *CtrlStr, char **argv_end, data/giflib-5.2.1/getarg.c:131:27: [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 ***argv, void *Parameters[MAX_PARAM], data/giflib-5.2.1/getarg.c:171:5: [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 CtrlStrCopy[CTRL_STR_MAX_LEN]; data/giflib-5.2.1/getarg.c:206:16: [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. GATestAllSatis(char *CtrlStrCopy, data/giflib-5.2.1/getarg.c:207:16: [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 *CtrlStr, data/giflib-5.2.1/getarg.c:208:16: [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 **argv_end, data/giflib-5.2.1/getarg.c:209:16: [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 ***argv, data/giflib-5.2.1/getarg.c:221:9: [2] (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). Risk is low because the source is a constant string. strcpy(LocalToken, "-?"); data/giflib-5.2.1/getarg.c:231:4: [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 ***)Parameters[(*ParamCount)++] = *argv; data/giflib-5.2.1/getarg.c:353:10: [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 **)Parameters[(*ParamCount)++] = *((*argv)++); data/giflib-5.2.1/getarg.c:403:9: [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 *ChrArray[MAX_PARAM]; data/giflib-5.2.1/gif2rgb.c:91:22: [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 ((rgbfp[0] = fopen(FileName, "rb")) == NULL) data/giflib-5.2.1/gif2rgb.c:96:6: [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 OneFileName[80]; data/giflib-5.2.1/gif2rgb.c:103:19: [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 ((rgbfp[i] = fopen(OneFileName, "rb")) == NULL) data/giflib-5.2.1/gif2rgb.c:257:29: [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 ((rgbfp[0] = fopen(FileName, "wb")) == NULL) data/giflib-5.2.1/gif2rgb.c:261:6: [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 OneFileName[80]; data/giflib-5.2.1/gif2rgb.c:268:33: [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 ((rgbfp[i] = fopen(OneFileName, "wb")) == NULL) { data/giflib-5.2.1/gif2rgb.c:309:18: [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 *Buffers[3]; data/giflib-5.2.1/gif2rgb.c:331:15: [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. free((char *) Buffers[0]); data/giflib-5.2.1/gif2rgb.c:332:15: [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. free((char *) Buffers[1]); data/giflib-5.2.1/gif2rgb.c:333:15: [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. free((char *) Buffers[2]); data/giflib-5.2.1/gif2rgb.c:397:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ScreenBuffer[i], ScreenBuffer[0], Size); data/giflib-5.2.1/gifalloc.c:69:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((char *)Object->Colors, data/giflib-5.2.1/gifalloc.c:258:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ep->Bytes, ExtData, Len); data/giflib-5.2.1/gifalloc.c:343:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((char *)sp, CopyFrom, sizeof(SavedImage)); data/giflib-5.2.1/gifalloc.c:371:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(sp->RasterBits, CopyFrom->RasterBits, data/giflib-5.2.1/gifalloc.c:384:17: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(sp->ExtensionBlocks, CopyFrom->ExtensionBlocks, data/giflib-5.2.1/gifbuild.c:50:5: [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 *TextLines[1]; data/giflib-5.2.1/gifbuild.c:93:16: [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 ((fp = fopen(FileNames[i], "r")) == (FILE *)NULL) data/giflib-5.2.1/gifbuild.c:126:5: [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 GlobalColorKeys[PRINTABLES], LocalColorKeys[PRINTABLES], data/giflib-5.2.1/gifbuild.c:131:5: [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 buf[BUFSIZ * 2], InclusionFile[64]; data/giflib-5.2.1/gifbuild.c:456:15: [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 params[3] = {1, 0, 0}; data/giflib-5.2.1/gifclrmp.c:111:27: [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 ((TranslateFile = fopen(TranslateFileName, "rt")) == NULL) data/giflib-5.2.1/gifclrmp.c:117:23: [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 ((ColorFile = fopen(ColorFileName, "rt")) == NULL) data/giflib-5.2.1/gifcolor.c:45:5: [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 Line[LINE_LEN]; data/giflib-5.2.1/gifecho.c:61:5: [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 *TextLines[MAX_NUM_TEXT_LINES]; data/giflib-5.2.1/gifecho.c:95: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 Line[LINE_LEN]; data/giflib-5.2.1/gifinto.c:52:1: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). mkstemp(char *tpl) data/giflib-5.2.1/gifinto.c:135:7: [2] (misc) open: 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). FD = open(tmpFN, O_CREAT | O_EXCL | O_WRONLY); data/giflib-5.2.1/gifinto.c:139:10: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). FD = mkstemp(FoutTmpName); /* returns filedescriptor */ data/giflib-5.2.1/gifinto.c:165:6: [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 DefaultName[STRLEN+1]; data/giflib-5.2.1/gifinto.c:171:3: [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 s[STRLEN]; data/giflib-5.2.1/giftext.c:366:12: [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. static char HexForm[49], AsciiForm[17]; data/giflib-5.2.1/giftext.c:411:12: [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. static char HexForm[49], AsciiForm[17]; data/giflib-5.2.1/giftool.c:126:36: [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). top->numerator = (GifByteType)atoi(optarg); data/giflib-5.2.1/giftool.c:131: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). top->color = atoi(optarg); data/giflib-5.2.1/giftool.c:136: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). top->delay = atoi(optarg); data/giflib-5.2.1/giftool.c:159:31: [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). selected[nselected++] = atoi(cp)-1; data/giflib-5.2.1/giftool.c:184:17: [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). top->p.x = atoi(optarg); data/giflib-5.2.1/giftool.c:185:17: [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). top->p.y = atoi(cp+1); data/giflib-5.2.1/giftool.c:200:21: [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). top->dispose = atoi(optarg); data/giflib-5.2.1/qprintf.c:30: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 Line[128]; data/giflib-5.2.1/egif_lib.c:299:15: [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). strlen(write_version)) != strlen(write_version)) { data/giflib-5.2.1/egif_lib.c:299:41: [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). strlen(write_version)) != strlen(write_version)) { data/giflib-5.2.1/egif_lib.c:520:14: [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). length = strlen(Comment); data/giflib-5.2.1/getarg.c:175:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(CtrlStrCopy, CtrlStr, sizeof(CtrlStrCopy)-1); data/giflib-5.2.1/getarg.c:176:30: [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). GASetParamCount(CtrlStr, strlen(CtrlStr), &ParamCount); data/giflib-5.2.1/getarg.c:227:14: [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). for (i = strlen(CtrlStr) - 1; i > 0 && !ISSPACE(CtrlStr[i]); i--) ; data/giflib-5.2.1/getarg.c:235:23: [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). while (++i < (int)strlen(CtrlStrCopy)) data/giflib-5.2.1/getarg.c:265:25: [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). while (i + 2 < (int)strlen(CtrlStrCopy)) { data/giflib-5.2.1/getarg.c:273:23: [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 (i + 2 >= (int)strlen(CtrlStrCopy)) { data/giflib-5.2.1/getarg.c:577:21: [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). while (i < (int)strlen(CtrlStr)) { data/giflib-5.2.1/getarg.c:579:51: [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). while ((ISSPACE(CtrlStr[i])) && (i < (int)strlen(CtrlStr))) data/giflib-5.2.1/getarg.c:586:59: [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). while (!ISCTRLCHAR(CtrlStr[i]) && (i < (int)strlen(CtrlStr)) && data/giflib-5.2.1/getarg.c:598:56: [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). while (!ISSPACE(CtrlStr[i]) && (i < (int)strlen(CtrlStr))) { data/giflib-5.2.1/getarg.c:609:59: [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). while (!ISCTRLCHAR(CtrlStr[i]) && (i < (int)strlen(CtrlStr)) && data/giflib-5.2.1/getarg.c:621:56: [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). while (!ISSPACE(CtrlStr[i]) && (i < (int)strlen(CtrlStr))) { data/giflib-5.2.1/getarg.c:629:56: [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). while (!ISSPACE(CtrlStr[i]) && (i < (int)strlen(CtrlStr)) && data/giflib-5.2.1/gif2rgb.c:99:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(OneFileName, FileName, sizeof(OneFileName)-1); data/giflib-5.2.1/gif2rgb.c:100:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(OneFileName, Postfixes[i], data/giflib-5.2.1/gif2rgb.c:101:30: [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). sizeof(OneFileName) - 1 - strlen(OneFileName)); data/giflib-5.2.1/gif2rgb.c:264:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(OneFileName, FileName, sizeof(OneFileName)-1); data/giflib-5.2.1/gif2rgb.c:265:17: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(OneFileName, Postfixes[i], data/giflib-5.2.1/gif2rgb.c:266:30: [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). sizeof(OneFileName) - 1 - strlen(OneFileName)); data/giflib-5.2.1/gif_font.c:232:18: [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). dup = malloc(strlen(legend)+1); data/giflib-5.2.1/gif_font.c:247:28: [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). leadspace = (TextWidth - strlen(++cp)) / 2; data/giflib-5.2.1/gifbg.c:111:26: [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). for (i = 0; i < (int)strlen(DirectionStr); i++) data/giflib-5.2.1/gifbg.c:118:10: [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(DirectionStr) < 2) data/giflib-5.2.1/gifbg.c:139:10: [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(DirectionStr) < 2) { data/giflib-5.2.1/gifbuild.c:282:11: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. else if (sscanf(buf, "include %63s", InclusionFile) == 1) data/giflib-5.2.1/gifbuild.c:374:11: [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). buf[strlen(buf) - 1] = '\0'; data/giflib-5.2.1/gifbuild.c:396:11: [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). buf[strlen(buf) - 1] = '\0'; data/giflib-5.2.1/gifbuild.c:486:11: [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). buf[strlen(buf) - 1] = '\0'; data/giflib-5.2.1/gifbuild.c:576:16: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c = fgetc(txtin)) == EOF) { data/giflib-5.2.1/gifbuild.c:597:13: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c = fgetc(txtin)) == EOF) { data/giflib-5.2.1/gifcolor.c:144: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). int i, j, k, CharPosX, Len = strlen(TextLine); data/giflib-5.2.1/gifecho.c:92:32: [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). ImageWidth = GIF_FONT_WIDTH * strlen(TextLines[0]); data/giflib-5.2.1/gifecho.c:98:15: [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). for (i = strlen(Line); i > 0 && Line[i-1] <= ' '; i--); data/giflib-5.2.1/gifecho.c:181: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). int i, j, k, CharPosX, Len = strlen(TextLine); data/giflib-5.2.1/gifinto.c:116:10: [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(*FileName) > STRLEN-1 ) GIF_EXIT("Filename too long."); data/giflib-5.2.1/gifinto.c:118:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(FullPath, *FileName, STRLEN); data/giflib-5.2.1/gifinto.c:127:10: [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(FullPath) > STRLEN-1 ) GIF_EXIT("Filename too long."); data/giflib-5.2.1/gifinto.c:128:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(FoutTmpName, FullPath, STRLEN); /* First setup the Path */ data/giflib-5.2.1/gifinto.c:130:11: [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(FoutTmpName) + strlen(DEFAULT_TMP_NAME)) > STRLEN-1 ) GIF_EXIT("Filename too long."); data/giflib-5.2.1/gifinto.c:130:33: [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(FoutTmpName) + strlen(DEFAULT_TMP_NAME)) > STRLEN-1 ) GIF_EXIT("Filename too long."); data/giflib-5.2.1/gifinto.c:152:10: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(Fin); data/giflib-5.2.1/gifinto.c:167: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). if ( (strlen(FullPath) + strlen(DEFAULT_OUT_NAME)) > STRLEN-1 ) GIF_EXIT("Filename too long."); data/giflib-5.2.1/gifinto.c:167:31: [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(FullPath) + strlen(DEFAULT_OUT_NAME)) > STRLEN-1 ) GIF_EXIT("Filename too long."); data/giflib-5.2.1/gifinto.c:168:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(DefaultName, FullPath, STRLEN); ANALYSIS SUMMARY: Hits = 125 Lines analyzed = 9542 in approximately 0.32 seconds (29618 lines/second) Physical Source Lines of Code (SLOC) = 6971 Hits@level = [0] 200 [1] 47 [2] 62 [3] 1 [4] 15 [5] 0 Hits@level+ = [0+] 325 [1+] 125 [2+] 78 [3+] 16 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 46.6217 [1+] 17.9314 [2+] 11.1892 [3+] 2.29522 [4+] 2.15177 [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.