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/sip4-4.19.24+dfsg/sipgen/heap.c Examining data/sip4-4.19.24+dfsg/sipgen/transform.c Examining data/sip4-4.19.24+dfsg/sipgen/gencode.c Examining data/sip4-4.19.24+dfsg/sipgen/extracts.c Examining data/sip4-4.19.24+dfsg/sipgen/sip.h Examining data/sip4-4.19.24+dfsg/sipgen/main.c Examining data/sip4-4.19.24+dfsg/sipgen/export.c Examining data/sip4-4.19.24+dfsg/sipgen/type_hints.c Examining data/sip4-4.19.24+dfsg/siplib/voidptr.c Examining data/sip4-4.19.24+dfsg/siplib/objmap.c Examining data/sip4-4.19.24+dfsg/siplib/array.c Examining data/sip4-4.19.24+dfsg/siplib/int_convertors.c Examining data/sip4-4.19.24+dfsg/siplib/sip.h Examining data/sip4-4.19.24+dfsg/siplib/apiversions.c Examining data/sip4-4.19.24+dfsg/siplib/siplib.c Examining data/sip4-4.19.24+dfsg/siplib/array.h Examining data/sip4-4.19.24+dfsg/siplib/descriptors.c Examining data/sip4-4.19.24+dfsg/siplib/qtlib.c Examining data/sip4-4.19.24+dfsg/siplib/bool.cpp Examining data/sip4-4.19.24+dfsg/siplib/threads.c Examining data/sip4-4.19.24+dfsg/siplib/sipint.h FINAL RESULTS: data/sip4-4.19.24+dfsg/sipgen/heap.c:103:3: [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(new,sp); data/sip4-4.19.24+dfsg/sipgen/heap.c:120:2: [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(*s,new); data/sip4-4.19.24+dfsg/sipgen/main.c:533:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, ap); data/sip4-4.19.24+dfsg/sipgen/main.c:556:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr,fmt,ap); data/sip4-4.19.24+dfsg/sipgen/transform.c:3249:13: [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). strcpy(new_vname + pos + 1, cp + 2); data/sip4-4.19.24+dfsg/sipgen/transform.c:3265:13: [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). strcpy(new_dst + (cp - dst) + value_len, cp + name_len); data/sip4-4.19.24+dfsg/sipgen/type_hints.c:598:5: [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. fprintf(fp, (cd == NULL) ? ") -> None: ...\n" : ")"); data/sip4-4.19.24+dfsg/sipgen/type_hints.c:931:13: [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. fprintf(fp, ad->defval->u.vnum ? "True" : "False"); data/sip4-4.19.24+dfsg/sipgen/type_hints.c:980:13: [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. fprintf(fp, anyObject(pep484)); data/sip4-4.19.24+dfsg/sipgen/type_hints.c:1241:9: [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. fprintf(fp, (indent ? "\n" : "\n\n")); data/sip4-4.19.24+dfsg/siplib/apiversions.c:236: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). strcpy(api_copy, api); data/sip4-4.19.24+dfsg/siplib/qtlib.c:560: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). strcpy(d,s); data/sip4-4.19.24+dfsg/siplib/qtlib.c:632:17: [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). strcpy(&sp -> name[1],meth); data/sip4-4.19.24+dfsg/siplib/siplib.c:1323:9: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, ap); data/sip4-4.19.24+dfsg/sipgen/export.c:84:15: [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(apiFile, "w")) == NULL) data/sip4-4.19.24+dfsg/sipgen/export.c:294:15: [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(xmlFile, "w")) == NULL) data/sip4-4.19.24+dfsg/sipgen/extracts.c:58: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 ((fp = fopen(fname, "w")) == NULL) data/sip4-4.19.24+dfsg/sipgen/gencode.c:1117: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[50]; data/sip4-4.19.24+dfsg/sipgen/gencode.c:1119:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "part%d", part); data/sip4-4.19.24+dfsg/sipgen/gencode.c:4182: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 buf[50]; data/sip4-4.19.24+dfsg/sipgen/gencode.c:4184:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "_%d", iff->api_range->index); data/sip4-4.19.24+dfsg/sipgen/gencode.c:9417: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[50]; data/sip4-4.19.24+dfsg/sipgen/gencode.c:9434:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "a%d", a); data/sip4-4.19.24+dfsg/sipgen/gencode.c:12051: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 vnamebuf[50]; data/sip4-4.19.24+dfsg/sipgen/gencode.c:12240:13: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(vnamebuf, "a%d", only); data/sip4-4.19.24+dfsg/sipgen/gencode.c:14170: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 fmt[3]; data/sip4-4.19.24+dfsg/sipgen/gencode.c:14396:15: [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(fname, "w")) == NULL) data/sip4-4.19.24+dfsg/sipgen/main.c:343:46: [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 (fname != NULL && fp == NULL && (fp = fopen(fname,"r")) == NULL) data/sip4-4.19.24+dfsg/sipgen/main.c:348: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 buf[200], *cp, *fname; data/sip4-4.19.24+dfsg/sipgen/transform.c:3247: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(new_vname, vname, pos); data/sip4-4.19.24+dfsg/sipgen/transform.c:3263: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(new_dst, dst, cp - dst); data/sip4-4.19.24+dfsg/sipgen/transform.c:3264: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(new_dst + (cp - dst), vname, value_len); data/sip4-4.19.24+dfsg/sipgen/type_hints.c:101:15: [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(pyiFile, "w")) == NULL) data/sip4-4.19.24+dfsg/siplib/siplib.c:8156: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[100]; data/sip4-4.19.24+dfsg/siplib/voidptr.c:255: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[2 + 16 + 1]; data/sip4-4.19.24+dfsg/sipgen/extracts.c:51:17: [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(ed->id) == id_len && strncmp(ed->id, id, id_len) == 0) data/sip4-4.19.24+dfsg/sipgen/heap.c:91: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). len += strlen(sp); data/sip4-4.19.24+dfsg/sipgen/heap.c:117: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 ((*s = realloc(*s,strlen(*s) + strlen(new) + 1)) == NULL) data/sip4-4.19.24+dfsg/sipgen/heap.c:117:36: [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 ((*s = realloc(*s,strlen(*s) + strlen(new) + 1)) == NULL) data/sip4-4.19.24+dfsg/sipgen/main.c:354:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = fgetc(fp)) != EOF) data/sip4-4.19.24+dfsg/sipgen/transform.c:3238:20: [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). name_len = strlen(names->name); data/sip4-4.19.24+dfsg/sipgen/transform.c:3239: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). value_len = strlen(vname); data/sip4-4.19.24+dfsg/sipgen/transform.c:3261:39: [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). char *new_dst = sipMalloc(strlen(dst) - name_len + value_len + 1); data/sip4-4.19.24+dfsg/sipgen/type_hints.c:1495: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). thd->raw_hint + strlen(thd->raw_hint), &thd->root); data/sip4-4.19.24+dfsg/siplib/apiversions.c:233:40: [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 ((api_copy = sip_api_malloc(strlen(api) + 1)) == NULL) data/sip4-4.19.24+dfsg/siplib/qtlib.c:559:37: [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 ((d = (char *)sip_api_malloc(strlen(s) + 1)) != NULL) data/sip4-4.19.24+dfsg/siplib/qtlib.c:624:58: [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 ((sp -> name = (char *)sip_api_malloc(strlen(meth) + 2)) == NULL) data/sip4-4.19.24+dfsg/siplib/siplib.c:2310:29: [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 ((args = PyTuple_New(strlen(fmt))) != NULL && buildObject(args, fmt, va) != NULL) data/sip4-4.19.24+dfsg/siplib/siplib.c:2339:29: [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 ((args = PyTuple_New(strlen(fmt))) == NULL) data/sip4-4.19.24+dfsg/siplib/siplib.c:2432: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). else if (strlen(fmt) == 1) data/sip4-4.19.24+dfsg/siplib/siplib.c:2669:65: [1] (buffer) wcslen: 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). el = PyUnicode_FromWideChar(s, (SIP_SSIZE_T)wcslen(s)); data/sip4-4.19.24+dfsg/siplib/siplib.c:8633: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). w = PyUnicode_DecodeASCII(si->si_val, strlen(si->si_val), NULL); data/sip4-4.19.24+dfsg/siplib/siplib.c:8637:52: [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). w = PyUnicode_DecodeLatin1(si->si_val, strlen(si->si_val), NULL); data/sip4-4.19.24+dfsg/siplib/siplib.c:8644:50: [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). w = PyUnicode_DecodeUTF8(si->si_val, strlen(si->si_val), NULL); data/sip4-4.19.24+dfsg/siplib/siplib.c:8662:21: [1] (buffer) wcslen: 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). wcslen((const wchar_t *)si->si_val)); ANALYSIS SUMMARY: Hits = 55 Lines analyzed = 47352 in approximately 0.98 seconds (48370 lines/second) Physical Source Lines of Code (SLOC) = 31851 Hits@level = [0] 237 [1] 20 [2] 21 [3] 0 [4] 14 [5] 0 Hits@level+ = [0+] 292 [1+] 55 [2+] 35 [3+] 14 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 9.16769 [1+] 1.72679 [2+] 1.09887 [3+] 0.439547 [4+] 0.439547 [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.