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/ussp-push-0.11/src/obex_macros.h Examining data/ussp-push-0.11/src/obex_main.h Examining data/ussp-push-0.11/src/obex_sdp.c Examining data/ussp-push-0.11/src/obex_sdp.h Examining data/ussp-push-0.11/src/obex_socket.h Examining data/ussp-push-0.11/src/obex_socket.c Examining data/ussp-push-0.11/src/obex_main.c FINAL RESULTS: data/ussp-push-0.11/src/obex_macros.h:29:50: [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. #define BTDEBUG(fmt, args...) do { if (bt_debug) fprintf(stderr, fmt, ##args); } while (0) data/ussp-push-0.11/src/obex_macros.h:30:31: [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. #define BTERROR(fmt, args...) fprintf(stderr, fmt, ##args); data/ussp-push-0.11/src/obex_socket.c:86: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. char const *env = getenv("HOME"); data/ussp-push-0.11/src/obex_main.c:126: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(filename, O_RDONLY, 0); data/ussp-push-0.11/src/obex_main.c:431:13: [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). devid = atoi(argv[i]); data/ussp-push-0.11/src/obex_main.c:434:15: [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). timeout = atoi(argv[i]); data/ussp-push-0.11/src/obex_sdp.c:80: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 uuid_str[MAX_LEN_UUID_STR]; data/ussp-push-0.11/src/obex_sdp.c:81: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 svc_uuid_str[MAX_LEN_SERVICECLASS_UUID_STR]; data/ussp-push-0.11/src/obex_sdp.c:98: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 str[32]; data/ussp-push-0.11/src/obex_socket.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 inputbuf[4096]; data/ussp-push-0.11/src/obex_socket.c:99: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 buf[512]; data/ussp-push-0.11/src/obex_socket.c:121: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 cfname[256]; data/ussp-push-0.11/src/obex_socket.c:124:14: [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 ((file = fopen(cfname, "rt")) == NULL) data/ussp-push-0.11/src/obex_socket.c:135: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 addr[128]; data/ussp-push-0.11/src/obex_socket.c:151:4: [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(straddr + 2 + (i - 1) * 3, ":%02X", btaddr->b[5 - i]); data/ussp-push-0.11/src/obex_socket.c:153:4: [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(straddr, "%02X", btaddr->b[5]); data/ussp-push-0.11/src/obex_socket.c:178: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 cfname[256]; data/ussp-push-0.11/src/obex_socket.c:183:14: [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 ((file = fopen(cfname, "r+t")) == NULL && (file = fopen(cfname, "w+t")) == NULL) data/ussp-push-0.11/src/obex_socket.c:183:55: [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 ((file = fopen(cfname, "r+t")) == NULL && (file = fopen(cfname, "w+t")) == NULL) data/ussp-push-0.11/src/obex_socket.c:198: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 devname[128]; data/ussp-push-0.11/src/obex_socket.c:233: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 straddr[64], rstraddr[64]; data/ussp-push-0.11/src/obex_socket.c:296:19: [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 ((gt->rfd = open(gt->portname, O_RDWR | O_NONBLOCK | O_NOCTTY, 0)) < 0) { data/ussp-push-0.11/src/obex_socket.c:363:15: [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). gt->chan = atoi(chan + 1); data/ussp-push-0.11/src/obex_socket.c:544: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(&expectlen, gt->inputbuf + 1, 2); data/ussp-push-0.11/src/obex_main.c:94: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). len = n = strlen((char *) c); data/ussp-push-0.11/src/obex_main.c:136:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). actual = read(fd, buf, *file_size); data/ussp-push-0.11/src/obex_main.c:382: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). name_len = (strlen(name) + 1) << 1; data/ussp-push-0.11/src/obex_socket.c:103: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). buf[strlen(buf) - 1] = 0; data/ussp-push-0.11/src/obex_socket.c:362: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(chan + 1) > 0) data/ussp-push-0.11/src/obex_socket.c:528:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(gt->rfd, >->inputbuf[actual], sizeof(gt->inputbuf) - actual); ANALYSIS SUMMARY: Hits = 30 Lines analyzed = 1334 in approximately 0.05 seconds (29014 lines/second) Physical Source Lines of Code (SLOC) = 923 Hits@level = [0] 16 [1] 6 [2] 21 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 46 [1+] 30 [2+] 24 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 49.8375 [1+] 32.5027 [2+] 26.0022 [3+] 3.25027 [4+] 2.16685 [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.