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/python-gammu-2.12/include/misc.h Examining data/python-gammu-2.12/include/data.h Examining data/python-gammu-2.12/include/errors.h Examining data/python-gammu-2.12/include/convertors.h Examining data/python-gammu-2.12/gammu/src/errors.c Examining data/python-gammu-2.12/gammu/src/misc.c Examining data/python-gammu-2.12/gammu/src/smsd.c Examining data/python-gammu-2.12/gammu/src/convertors/memory.c Examining data/python-gammu-2.12/gammu/src/convertors/sms.c Examining data/python-gammu-2.12/gammu/src/convertors/file.c Examining data/python-gammu-2.12/gammu/src/convertors/base.c Examining data/python-gammu-2.12/gammu/src/convertors/wap.c Examining data/python-gammu-2.12/gammu/src/convertors/diverts.c Examining data/python-gammu-2.12/gammu/src/convertors/call.c Examining data/python-gammu-2.12/gammu/src/convertors/bitmap.c Examining data/python-gammu-2.12/gammu/src/convertors/time.c Examining data/python-gammu-2.12/gammu/src/convertors/backup.c Examining data/python-gammu-2.12/gammu/src/convertors/misc.c Examining data/python-gammu-2.12/gammu/src/convertors/ringtone.c Examining data/python-gammu-2.12/gammu/src/convertors/string.c Examining data/python-gammu-2.12/gammu/src/convertors/todo.c Examining data/python-gammu-2.12/gammu/src/convertors/calendar.c Examining data/python-gammu-2.12/gammu/src/gammu.c Examining data/python-gammu-2.12/gammu/src/data.c FINAL RESULTS: data/python-gammu-2.12/gammu/src/convertors/backup.c:197:3: [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(backup->Creator, "python-gammu " GAMMU_VERSION); data/python-gammu-2.12/gammu/src/convertors/wap.c:113:2: [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(s, mms->Address); data/python-gammu-2.12/gammu/src/convertors/wap.c:125:2: [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(s, mms->Title); data/python-gammu-2.12/gammu/src/convertors/wap.c:137:2: [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(s, mms->Sender); data/python-gammu-2.12/gammu/src/errors.c:128:9: [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(errname, GSM_ErrorName(error)); data/python-gammu-2.12/gammu/src/errors.c:136:9: [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(errname, GSM_ErrorName(error)); data/python-gammu-2.12/gammu/src/misc.c:44:8: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. ret = vprintf(format, ap); data/python-gammu-2.12/gammu/src/misc.c:58:8: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. ret = vprintf(format, ap); data/python-gammu-2.12/gammu/src/convertors/base.c:64:9: [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). i = atoi(s); data/python-gammu-2.12/gammu/src/convertors/base.c:92:9: [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). i = atoi(s); data/python-gammu-2.12/gammu/src/convertors/base.c:175:8: [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). i = atoi(s); data/python-gammu-2.12/gammu/src/convertors/base.c:193:8: [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). i = atoi(s); data/python-gammu-2.12/gammu/src/convertors/base.c:328: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(result, ps, length); data/python-gammu-2.12/gammu/src/convertors/base.c:373: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(result, data, *length); data/python-gammu-2.12/gammu/src/convertors/bitmap.c:113: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[1000]; data/python-gammu-2.12/gammu/src/convertors/bitmap.c:314: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[1000]; data/python-gammu-2.12/gammu/src/convertors/file.c:287: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(file->Buffer, s, i); data/python-gammu-2.12/gammu/src/convertors/sms.c:31: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 s[100] = ""; data/python-gammu-2.12/gammu/src/convertors/sms.c:39:4: [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(s, "NA"); data/python-gammu-2.12/gammu/src/convertors/sms.c:49:5: [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(s, "Max"); data/python-gammu-2.12/gammu/src/convertors/sms.c:97:8: [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). val = atoi(s); data/python-gammu-2.12/gammu/src/convertors/sms.c:671: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(udh->Text, s, udh->Length); data/python-gammu-2.12/gammu/src/convertors/sms.c:801: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(sms->Text, s, sms->Length); data/python-gammu-2.12/gammu/src/errors.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 errname[100]; data/python-gammu-2.12/gammu/src/errors.c:70: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 errhelp[4096]; data/python-gammu-2.12/gammu/src/errors.c:127: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(errname, "gammu.ERR_"); data/python-gammu-2.12/gammu/src/errors.c:135: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(errname, "ERR_"); data/python-gammu-2.12/gammu/src/gammu.c:913: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 value[GSM_MAX_MANUFACTURER_LENGTH + 1]; data/python-gammu-2.12/gammu/src/gammu.c:941: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 value[GSM_MAX_MODEL_LENGTH + 1]; data/python-gammu-2.12/gammu/src/gammu.c:969: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 firmware[GSM_MAX_VERSION_LENGTH + 1]; data/python-gammu-2.12/gammu/src/gammu.c:970: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 date[GSM_MAX_VERSION_DATE_LENGTH + 1]; data/python-gammu-2.12/gammu/src/gammu.c:1002: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 value[GSM_MAX_IMEI_LENGTH + 1]; data/python-gammu-2.12/gammu/src/gammu.c:1030: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[BUFFER_LENGTH]; data/python-gammu-2.12/gammu/src/gammu.c:1058: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[BUFFER_LENGTH]; data/python-gammu-2.12/gammu/src/gammu.c:1086: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[BUFFER_LENGTH]; data/python-gammu-2.12/gammu/src/gammu.c:1114: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[BUFFER_LENGTH]; data/python-gammu-2.12/gammu/src/gammu.c:1142: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[BUFFER_LENGTH]; data/python-gammu-2.12/gammu/src/gammu.c:1170: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[BUFFER_LENGTH]; data/python-gammu-2.12/gammu/src/gammu.c:1390: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 s[2]; data/python-gammu-2.12/gammu/src/gammu.c:5852: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[10240]; data/python-gammu-2.12/gammu/src/gammu.c:5955: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[10240]; data/python-gammu-2.12/gammu/src/gammu.c:5986: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[10240]; data/python-gammu-2.12/gammu/src/gammu.c:6017: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[10240]; data/python-gammu-2.12/gammu/src/gammu.c:6048: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[10240]; data/python-gammu-2.12/gammu/src/gammu.c:6127:13: [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). f = fopen(name, "wb"); data/python-gammu-2.12/gammu/src/gammu.c:6138:13: [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). f = fopen(name, "wb"); data/python-gammu-2.12/gammu/src/gammu.c:6456: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 buffer[1000]; data/python-gammu-2.12/gammu/src/gammu.c:6457: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 req[1000]; data/python-gammu-2.12/gammu/src/smsd.c:131: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 newid[200]; data/python-gammu-2.12/gammu/src/convertors/backup.c:172: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). len = strlen(s); data/python-gammu-2.12/gammu/src/convertors/backup.c:176: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(backup->IMEI, s, len); data/python-gammu-2.12/gammu/src/convertors/backup.c:185: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). len = strlen(s); data/python-gammu-2.12/gammu/src/convertors/backup.c:189: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(backup->Model, s, len); data/python-gammu-2.12/gammu/src/convertors/backup.c:199: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). len = strlen(s); data/python-gammu-2.12/gammu/src/convertors/base.c:322: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). length = strlen(ps) + 1; data/python-gammu-2.12/gammu/src/convertors/bitmap.c:255:7: [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. if (sscanf(s, "%c c %999s", &c, buffer) != 2) { data/python-gammu-2.12/gammu/src/convertors/bitmap.c:290: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 ((ssize_t) strlen(s) != w) { data/python-gammu-2.12/gammu/src/convertors/file.c:116: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). else if (strlen(s) == 0) data/python-gammu-2.12/gammu/src/convertors/sms.c:93:8: [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(s); data/python-gammu-2.12/gammu/src/convertors/string.c:172:8: [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(src); data/python-gammu-2.12/gammu/src/convertors/wap.c:108: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). } else if (strlen(s) > 499) { data/python-gammu-2.12/gammu/src/convertors/wap.c:120: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). } else if (strlen(s) > 499) { data/python-gammu-2.12/gammu/src/convertors/wap.c:132: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). } else if (strlen(s) > 499) { data/python-gammu-2.12/gammu/src/gammu.c:1449: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). if (strlen(ds) != 1) { data/python-gammu-2.12/gammu/src/gammu.c:1493: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). if (strlen(key) != 1) { data/python-gammu-2.12/gammu/src/misc.c:31:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dest, src, n); ANALYSIS SUMMARY: Hits = 66 Lines analyzed = 15124 in approximately 0.36 seconds (41606 lines/second) Physical Source Lines of Code (SLOC) = 11574 Hits@level = [0] 9 [1] 17 [2] 41 [3] 0 [4] 8 [5] 0 Hits@level+ = [0+] 75 [1+] 66 [2+] 49 [3+] 8 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 6.48004 [1+] 5.70244 [2+] 4.23363 [3+] 0.691204 [4+] 0.691204 [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.