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/libfs-1.0.7/include/X11/fonts/FSlib.h Examining data/libfs-1.0.7/src/FSlibos.h Examining data/libfs-1.0.7/src/FSErrHndlr.c Examining data/libfs-1.0.7/src/FSFlush.c Examining data/libfs-1.0.7/src/FSFtNames.c Examining data/libfs-1.0.7/src/FSlibint.h Examining data/libfs-1.0.7/src/FSCloseFt.c Examining data/libfs-1.0.7/src/FSClServ.c Examining data/libfs-1.0.7/src/FSGetCats.c Examining data/libfs-1.0.7/src/FSSetCats.c Examining data/libfs-1.0.7/src/FSlibInt.c Examining data/libfs-1.0.7/src/FSQGlyphs.c Examining data/libfs-1.0.7/src/FSQXExt.c Examining data/libfs-1.0.7/src/FSSync.c Examining data/libfs-1.0.7/src/FSFontInfo.c Examining data/libfs-1.0.7/src/FSServName.c Examining data/libfs-1.0.7/src/FSListExt.c Examining data/libfs-1.0.7/src/fs_transport.c Examining data/libfs-1.0.7/src/FSQuExt.c Examining data/libfs-1.0.7/src/FSNextEv.c Examining data/libfs-1.0.7/src/FSMisc.c Examining data/libfs-1.0.7/src/FSOpenFont.c Examining data/libfs-1.0.7/src/FSSynchro.c Examining data/libfs-1.0.7/src/FSQXInfo.c Examining data/libfs-1.0.7/src/FSOpenServ.c Examining data/libfs-1.0.7/src/FSListCats.c Examining data/libfs-1.0.7/src/FSErrDis.c Examining data/libfs-1.0.7/src/FSConnServ.c Examining data/libfs-1.0.7/test/FSGetErrorText.c FINAL RESULTS: data/libfs-1.0.7/src/FSlibInt.c:843:12: [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(fp, mesg, event->request_code); data/libfs-1.0.7/src/FSlibInt.c:856:6: [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(buffer, ext->name); data/libfs-1.0.7/src/FSlibInt.c:864:12: [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(fp, mesg, event->minor_code); data/libfs-1.0.7/src/FSlibInt.c:874:12: [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(fp, mesg, event->resourceid); data/libfs-1.0.7/src/FSlibInt.c:878:12: [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(fp, mesg, event->serial); data/libfs-1.0.7/src/FSlibInt.c:882:12: [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(fp, mesg, svr->request); data/libfs-1.0.7/src/FSOpenServ.c:120:16: [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 ((server = getenv("FONTSERVER")) == NULL) { data/libfs-1.0.7/src/FSServName.c:68:14: [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 ((s = getenv("FONTSERVER")) != NULL) data/libfs-1.0.7/src/FSConnServ.c:167: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 buf[BUFSIZE]; data/libfs-1.0.7/src/FSErrDis.c:104: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[32]; data/libfs-1.0.7/src/FSFontInfo.c:194:23: [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. _FSReadPad(svr, (char *) pd[i], pi[i]->data_len); data/libfs-1.0.7/src/FSFontInfo.c:196:20: [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. _FSRead(svr, (char *) pd[i], pi[i]->data_len); data/libfs-1.0.7/src/FSOpenFont.c:69: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[256]; data/libfs-1.0.7/src/FSOpenFont.c:75: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(&buf[1], name, nbytes); data/libfs-1.0.7/src/FSSetCats.c:65: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[256]; data/libfs-1.0.7/src/FSSetCats.c:84:6: [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(&buf[1], cats[i], nbytes); data/libfs-1.0.7/src/FSlibInt.c:185: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[BUFSIZE]; data/libfs-1.0.7/src/FSlibInt.c:315: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 pad[3]; data/libfs-1.0.7/src/FSlibInt.c:339:8: [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 *)iov[1].iov_base + pad_bytes_read; data/libfs-1.0.7/src/FSlibInt.c:343:22: [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. iov[0].iov_base = (char *)iov[0].iov_base + bytes_read; data/libfs-1.0.7/src/FSlibInt.c:380: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 pad[3] = {0, 0, 0}; data/libfs-1.0.7/src/FSlibInt.c:589:3: [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(&err, rep, SIZEOF(fsReply)); data/libfs-1.0.7/src/FSlibInt.c:648: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[SCRATCHSIZE]; data/libfs-1.0.7/src/FSlibInt.c:831: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 buffer[BUFSIZ]; data/libfs-1.0.7/src/FSlibInt.c:832: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 mesg[BUFSIZ]; data/libfs-1.0.7/src/FSlibInt.c:833: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 number[32]; data/libfs-1.0.7/test/FSGetErrorText.c:39: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[128] = ""; data/libfs-1.0.7/src/FSErrDis.c:91:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(buffer, defaultp, nbytes); data/libfs-1.0.7/src/FSErrDis.c:92: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(defaultp) + 1) > nbytes) data/libfs-1.0.7/src/FSFontInfo.c:85:38: [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). nbytes = req->nbytes = pattern ? strlen(pattern) : 0; data/libfs-1.0.7/src/FSFtNames.c:75:38: [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). nbytes = req->nbytes = pattern ? strlen(pattern) : 0; data/libfs-1.0.7/src/FSListCats.c:75:38: [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). nbytes = req->nbytes = pattern ? strlen(pattern) : 0; data/libfs-1.0.7/src/FSOpenFont.c:71: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). nbytes = name ? strlen(name) : 0; data/libfs-1.0.7/src/FSQuExt.c:69: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). req->nbytes = name ? strlen(name) : 0; data/libfs-1.0.7/src/FSSetCats.c:70: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). if ((tlen = strlen(cats[i])) < 256) { data/libfs-1.0.7/src/FSSetCats.c:81: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). nbytes = strlen(cats[i]); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 4801 in approximately 0.27 seconds (17685 lines/second) Physical Source Lines of Code (SLOC) = 2609 Hits@level = [0] 17 [1] 9 [2] 19 [3] 2 [4] 6 [5] 0 Hits@level+ = [0+] 53 [1+] 36 [2+] 27 [3+] 8 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 20.3143 [1+] 13.7984 [2+] 10.3488 [3+] 3.06631 [4+] 2.29973 [5+] 0 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.