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/bgpq3-0.1.35/bgpq3.c Examining data/bgpq3-0.1.35/bgpq3.h Examining data/bgpq3-0.1.35/bgpq3_printer.c Examining data/bgpq3-0.1.35/bgpq_expander.c Examining data/bgpq3-0.1.35/strlcpy.c Examining data/bgpq3-0.1.35/sx_maxsockbuf.c Examining data/bgpq3-0.1.35/sx_maxsockbuf.h Examining data/bgpq3-0.1.35/sx_prefix.c Examining data/bgpq3-0.1.35/sx_prefix.h Examining data/bgpq3-0.1.35/sx_report.c Examining data/bgpq3-0.1.35/sx_report.h Examining data/bgpq3-0.1.35/sx_slentry.c Examining data/bgpq3-0.1.35/sx_slentry.h Examining data/bgpq3-0.1.35/sys_queue.h Examining data/bgpq3-0.1.35/sys_tree.h FINAL RESULTS: data/bgpq3-0.1.35/bgpq_expander.c:353:2: [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. vsnprintf(request,sizeof(request),fmt,ap); data/bgpq3-0.1.35/bgpq_expander.c:630:2: [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. vsnprintf(request,sizeof(request),fmt,ap); data/bgpq3-0.1.35/sx_report.c:38:2: [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. vsnprintf(buffer,sizeof(buffer),fmt,ap); data/bgpq3-0.1.35/sx_report.c:77:2: [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. vsnprintf(buffer,sizeof(buffer),fmt,ap); data/bgpq3-0.1.35/sx_report.h:16:26: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 2, 3))); data/bgpq3-0.1.35/sx_report.h:19:26: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 4, 5))); data/bgpq3-0.1.35/bgpq3.c:146: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. if (getenv("IRRD_SOURCES")) data/bgpq3-0.1.35/bgpq3.c:147:20: [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. expander.sources=getenv("IRRD_SOURCES"); data/bgpq3-0.1.35/bgpq3.c:149:11: [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,"2346a:AbBdDEF:S:jJf:l:L:m:M:NnW:Ppr:R:G:tTh:UwXsz")) data/bgpq3-0.1.35/bgpq3.c:321:30: [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). case 'W': expander.aswidth=atoi(optarg); data/bgpq3-0.1.35/bgpq3_printer.c:661: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:674: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:734: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:761: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 buffer[2048]; data/bgpq3-0.1.35/bgpq3_printer.c:795: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:871: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:902: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 prefix[128], seqno[16]=""; data/bgpq3-0.1.35/bgpq3_printer.c:932: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:957: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:987: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:1052: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:1066: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:1080: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:1105: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 prefix[128]; data/bgpq3-0.1.35/bgpq3_printer.c:1291: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 prefix[128]; data/bgpq3-0.1.35/bgpq_expander.c:348: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 request[128]; data/bgpq3-0.1.35/bgpq_expander.c:464: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. static char response[256]; data/bgpq3-0.1.35/bgpq_expander.c:514: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(recvbuffer, eon+1, togot); data/bgpq3-0.1.35/bgpq_expander.c:521: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(recvbuffer, eon+1, off - ((eon+1)-response)); data/bgpq3-0.1.35/bgpq_expander.c:624: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 request[128], response[128]; data/bgpq3-0.1.35/bgpq_expander.c:678:4: [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(recvbuffer, eon+1, togot); data/bgpq3-0.1.35/bgpq_expander.c:684:4: [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(recvbuffer, eon+1, off - ((eon+1)-response)); data/bgpq3-0.1.35/bgpq_expander.c:817: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 sources[slen]; data/bgpq3-0.1.35/bgpq_expander.c:832: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 ident[128]; data/bgpq3-0.1.35/sx_prefix.c:82: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 mtext[INET6_ADDRSTRLEN+5]; data/bgpq3-0.1.35/sx_prefix.c:282: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 buffer[128]; data/bgpq3-0.1.35/sx_prefix.c:294: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 buffer[128]; data/bgpq3-0.1.35/sx_prefix.c:373: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 buffer[128]; data/bgpq3-0.1.35/sx_prefix.c:554: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 pbuffer[128], cbuffer[128]; data/bgpq3-0.1.35/sx_prefix.c:646: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 pbuffer[128], cbuffer[128]; data/bgpq3-0.1.35/sx_prefix.c:659: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 buffer[128]; data/bgpq3-0.1.35/sx_prefix.h:15: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. unsigned char addrs[sizeof(struct in6_addr)]; data/bgpq3-0.1.35/sx_report.c:34: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 buffer[65536]; data/bgpq3-0.1.35/sx_report.c:71: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 buffer[65536]; data/bgpq3-0.1.35/sx_report.c:72: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 bline[65536]; data/bgpq3-0.1.35/bgpq3_printer.c:1311: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 (strcmp(b->format+strlen(b->format-2), "\n")) data/bgpq3-0.1.35/bgpq_expander.c:330:13: [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). bp->size = strlen(bp->request); data/bgpq3-0.1.35/bgpq_expander.c:457:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return read(b->fd, buffer, size); data/bgpq3-0.1.35/bgpq_expander.c:551:13: [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). togot, strlen(recvbuffer), req->request); data/bgpq3-0.1.35/bgpq_expander.c:573: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). "to %sfinal code: %.*s",recvbuffer,strlen(recvbuffer),togot, data/bgpq3-0.1.35/bgpq_expander.c:637: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). ret=write(b->fd, request, strlen(request)); data/bgpq3-0.1.35/bgpq_expander.c:638: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(ret!=strlen(request)) { data/bgpq3-0.1.35/bgpq_expander.c:660: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). (unsigned long)strlen(response),response); data/bgpq3-0.1.35/bgpq_expander.c:723:19: [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). (unsigned long)strlen(recvbuffer), offset, recvbuffer, off, data/bgpq3-0.1.35/bgpq_expander.c:814: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). int slen = strlen(b->sources)+4; data/bgpq3-0.1.35/bgpq_expander.c:820: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). write(fd, sources, strlen(sources)); data/bgpq3-0.1.35/bgpq_expander.c:822:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, sources, slen); data/bgpq3-0.1.35/bgpq_expander.c:834: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). write(fd, ident, strlen(ident)); data/bgpq3-0.1.35/bgpq_expander.c:835:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, ident, sizeof(ident)); data/bgpq3-0.1.35/sx_prefix.c:323: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). off=strlen(buffer); data/bgpq3-0.1.35/sx_prefix.c:337: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). off=strlen(buffer); data/bgpq3-0.1.35/sx_prefix.c:342: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). off=strlen(buffer); data/bgpq3-0.1.35/sx_prefix.c:367:9: [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). return strlen(buffer); ANALYSIS SUMMARY: Hits = 63 Lines analyzed = 6127 in approximately 0.19 seconds (32542 lines/second) Physical Source Lines of Code (SLOC) = 5309 Hits@level = [0] 310 [1] 18 [2] 36 [3] 3 [4] 6 [5] 0 Hits@level+ = [0+] 373 [1+] 63 [2+] 45 [3+] 9 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 70.2581 [1+] 11.8666 [2+] 8.47617 [3+] 1.69523 [4+] 1.13016 [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.