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/idevicerestore-1.0.0/src/asr.c Examining data/idevicerestore-1.0.0/src/asr.h Examining data/idevicerestore-1.0.0/src/common.c Examining data/idevicerestore-1.0.0/src/common.h Examining data/idevicerestore-1.0.0/src/dfu.c Examining data/idevicerestore-1.0.0/src/dfu.h Examining data/idevicerestore-1.0.0/src/download.c Examining data/idevicerestore-1.0.0/src/download.h Examining data/idevicerestore-1.0.0/src/endianness.h Examining data/idevicerestore-1.0.0/src/fdr.c Examining data/idevicerestore-1.0.0/src/fdr.h Examining data/idevicerestore-1.0.0/src/fls.c Examining data/idevicerestore-1.0.0/src/fls.h Examining data/idevicerestore-1.0.0/src/ftab.c Examining data/idevicerestore-1.0.0/src/ftab.h Examining data/idevicerestore-1.0.0/src/idevicerestore.c Examining data/idevicerestore-1.0.0/src/idevicerestore.h Examining data/idevicerestore-1.0.0/src/img3.c Examining data/idevicerestore-1.0.0/src/img3.h Examining data/idevicerestore-1.0.0/src/img4.c Examining data/idevicerestore-1.0.0/src/img4.h Examining data/idevicerestore-1.0.0/src/ipsw.c Examining data/idevicerestore-1.0.0/src/ipsw.h Examining data/idevicerestore-1.0.0/src/jsmn.c Examining data/idevicerestore-1.0.0/src/jsmn.h Examining data/idevicerestore-1.0.0/src/json_plist.c Examining data/idevicerestore-1.0.0/src/json_plist.h Examining data/idevicerestore-1.0.0/src/limera1n.c Examining data/idevicerestore-1.0.0/src/limera1n.h Examining data/idevicerestore-1.0.0/src/limera1n_payload.h Examining data/idevicerestore-1.0.0/src/locking.c Examining data/idevicerestore-1.0.0/src/locking.h Examining data/idevicerestore-1.0.0/src/mbn.c Examining data/idevicerestore-1.0.0/src/mbn.h Examining data/idevicerestore-1.0.0/src/normal.c Examining data/idevicerestore-1.0.0/src/normal.h Examining data/idevicerestore-1.0.0/src/recovery.c Examining data/idevicerestore-1.0.0/src/recovery.h Examining data/idevicerestore-1.0.0/src/restore.c Examining data/idevicerestore-1.0.0/src/restore.h Examining data/idevicerestore-1.0.0/src/sha1.c Examining data/idevicerestore-1.0.0/src/sha1.h Examining data/idevicerestore-1.0.0/src/socket.c Examining data/idevicerestore-1.0.0/src/socket.h Examining data/idevicerestore-1.0.0/src/thread.c Examining data/idevicerestore-1.0.0/src/thread.h Examining data/idevicerestore-1.0.0/src/tss.c Examining data/idevicerestore-1.0.0/src/tss.h FINAL RESULTS: data/idevicerestore-1.0.0/src/common.c:86:2: [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((info_stream) ? info_stream : stdout, format, vargs); data/idevicerestore-1.0.0/src/common.c:95: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(idevicerestore_err_buff, idevicerestore_err_buff_size, format, vargs); data/idevicerestore-1.0.0/src/common.c:98:3: [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((error_stream) ? error_stream : stderr, format, vargs2); data/idevicerestore-1.0.0/src/common.c:111:2: [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((debug_stream) ? debug_stream : stderr, format, vargs); data/idevicerestore-1.0.0/src/common.c:430:17: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (!tmpdir || access(tmpdir, W_OK|X_OK) != 0) { data/idevicerestore-1.0.0/src/common.c:437:17: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (!tmpdir || access(tmpdir, W_OK|X_OK) != 0) { data/idevicerestore-1.0.0/src/common.c:493:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(filename, F_OK) != 0) { data/idevicerestore-1.0.0/src/common.h:122:23: [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, 1, 2))) data/idevicerestore-1.0.0/src/common.h:124:23: [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, 1, 2))) data/idevicerestore-1.0.0/src/common.h:126:23: [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, 1, 2))) data/idevicerestore-1.0.0/src/idevicerestore.c:157: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(version_xml, client->cache_dir); data/idevicerestore-1.0.0/src/idevicerestore.c:159: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(version_xml, VERSION_XML); data/idevicerestore-1.0.0/src/idevicerestore.c:161: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(version_xml, VERSION_XML); data/idevicerestore-1.0.0/src/idevicerestore.c:166: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(version_xml_tmp, version_xml); data/idevicerestore-1.0.0/src/idevicerestore.c:391:5: [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(wtfipsw, client->cache_dir); data/idevicerestore-1.0.0/src/idevicerestore.c:393:5: [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(wtfipsw, fnpart); data/idevicerestore-1.0.0/src/idevicerestore.c:395:5: [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(wtfipsw, fnpart); data/idevicerestore-1.0.0/src/idevicerestore.c:606:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(client->ipsw, F_OK) < 0) { data/idevicerestore-1.0.0/src/idevicerestore.c:663:4: [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(lcmodel, client->device->hardware_model); data/idevicerestore-1.0.0/src/idevicerestore.c:670:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(p_all_flash, "Firmware/all_flash/all_flash.%s.%s", lcmodel, "production"); data/idevicerestore-1.0.0/src/idevicerestore.c:671:4: [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(tmpstr, p_all_flash); data/idevicerestore-1.0.0/src/idevicerestore.c:698:5: [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(tmpstr, p_all_flash); data/idevicerestore-1.0.0/src/idevicerestore.c:700:5: [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(tmpstr, files[x]); data/idevicerestore-1.0.0/src/idevicerestore.c:719:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmpstr, "Firmware/dfu/iBSS.%s.%s.dfu", lcmodel, "RELEASE"); data/idevicerestore-1.0.0/src/idevicerestore.c:727:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmpstr, "Firmware/dfu/iBEC.%s.%s.dfu", lcmodel, "RELEASE"); data/idevicerestore-1.0.0/src/idevicerestore.c:918: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(tmpf, client->cache_dir); data/idevicerestore-1.0.0/src/idevicerestore.c:921: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(tmpf, basename(ipswtmp)); data/idevicerestore-1.0.0/src/idevicerestore.c:924: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(tmpf, client->ipsw); data/idevicerestore-1.0.0/src/idevicerestore.c:943: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(tmpf, fsname); data/idevicerestore-1.0.0/src/idevicerestore.c:957: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(extfn, tmpf); data/idevicerestore-1.0.0/src/idevicerestore.c:960: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(lockfn, tmpf); data/idevicerestore-1.0.0/src/idevicerestore.c:966:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(extfn, F_OK) != 0) { data/idevicerestore-1.0.0/src/idevicerestore.c:1110: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(zfn, client->cache_dir); data/idevicerestore-1.0.0/src/idevicerestore.c:1116:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(zfn+strlen(zfn), "/%" PRIu64 "-%s-%s.shsh", client->ecid, client->device->product_type, client->version); data/idevicerestore-1.0.0/src/idevicerestore.c:2064:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(zfn, "%s/shsh/%" PRIu64 "-%s-%s.shsh", client->cache_dir, client->ecid, client->device->product_type, client->version); data/idevicerestore-1.0.0/src/idevicerestore.c:2066:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(zfn, "shsh/%" PRIu64 "-%s-%s.shsh", client->ecid, client->device->product_type, client->version); data/idevicerestore-1.0.0/src/ipsw.c:248: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(actual_outfile, outfile); data/idevicerestore-1.0.0/src/ipsw.c:338:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(filepath, R_OK) != 0) { data/idevicerestore-1.0.0/src/ipsw.c:609:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(majstr, "%"PRIu64, (uint64_t)major); data/idevicerestore-1.0.0/src/ipsw.c:717:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fwlfn, "%s/%s", todir, fwfn); data/idevicerestore-1.0.0/src/ipsw.c:719:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fwlfn, "%s", fwfn); data/idevicerestore-1.0.0/src/ipsw.c:723:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fwlock, "%s.lock", fwlfn); data/idevicerestore-1.0.0/src/recovery.c:511: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(setba, client->restore_boot_args); data/idevicerestore-1.0.0/src/restore.c:946:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(compkeyname, "%sFile", component); data/idevicerestore-1.0.0/src/tss.c:53:2: [4] (format) snprintf: 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. snprintf(ecid_string, ECID_STRSIZE, "%"PRIu64, ecid); data/idevicerestore-1.0.0/src/common.c:258:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(time(NULL)); data/idevicerestore-1.0.0/src/common.c:429:34: [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. while (TMPVARS[i] && ((tmpdir = getenv(TMPVARS[i])) == NULL)) i++; data/idevicerestore-1.0.0/src/common.c:490:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. char* realpath(const char *filename, char *resolved_name) data/idevicerestore-1.0.0/src/common.c:501:25: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. #error please provide a realpath implementation for this platform data/idevicerestore-1.0.0/src/common.h:161:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. char* realpath(const char *filename, char *resolved_name); data/idevicerestore-1.0.0/src/idevicerestore.c:1574:16: [3] (buffer) getopt_long: 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 ((opt = getopt_long(argc, argv, "dhcesxtpli:u:nC:kyPRT:zv", longopts, &optindex)) > 0) { data/idevicerestore-1.0.0/src/ipsw.c:237:8: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (!realpath(filepath, actual_filepath)) { data/idevicerestore-1.0.0/src/ipsw.c:243:8: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(outfile, actual_outfile) && (strcmp(actual_filepath, actual_outfile) == 0)) { data/idevicerestore-1.0.0/src/thread.c:70:2: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(mutex); data/idevicerestore-1.0.0/src/thread.c:88:2: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(mutex); data/idevicerestore-1.0.0/src/asr.c:219:9: [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). file = fopen(filesystem, "rb"); data/idevicerestore-1.0.0/src/asr.c:355:9: [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). file = fopen(filesystem, "rb"); data/idevicerestore-1.0.0/src/common.c:71: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. static char idevicerestore_err_buff[idevicerestore_err_buff_size] = {0, }; data/idevicerestore-1.0.0/src/common.c:163:9: [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). file = fopen(filename, "wb"); data/idevicerestore-1.0.0/src/common.c:192:9: [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). file = fopen(filename, "rb"); data/idevicerestore-1.0.0/src/common.c:307:5: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int mkstemp(char *tmpl) data/idevicerestore-1.0.0/src/common.c:390:8: [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 (tmpl, O_RDWR | O_CREAT | O_EXCL, _S_IREAD | _S_IWRITE); data/idevicerestore-1.0.0/src/common.c:392:8: [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 (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); data/idevicerestore-1.0.0/src/common.c:447: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, tmpdir, lt); data/idevicerestore-1.0.0/src/common.c:454:2: [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(result + lt + lp, "XXXXXX"); data/idevicerestore-1.0.0/src/common.c:455:7: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp(result); data/idevicerestore-1.0.0/src/dfu.c:202: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(newdata, ticket, tsize); data/idevicerestore-1.0.0/src/dfu.c:204: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(newdata + fillsize, data, size); data/idevicerestore-1.0.0/src/dfu.c:292: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(*nonce, device_info->ap_nonce, *nonce_size); data/idevicerestore-1.0.0/src/dfu.c:316: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(*nonce, device_info->sep_nonce, *nonce_size); data/idevicerestore-1.0.0/src/download.c:39: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(response->content + response->length, data, total); data/idevicerestore-1.0.0/src/download.c:114:12: [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). FILE* f = fopen(filename, "wb"); data/idevicerestore-1.0.0/src/fdr.c:316: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 buf[16]; data/idevicerestore-1.0.0/src/fdr.c:396: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 buf[16]; data/idevicerestore-1.0.0/src/fdr.c:421: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[4096]; data/idevicerestore-1.0.0/src/fls.c:56: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((void*)xe, p, hdrsize); data/idevicerestore-1.0.0/src/fls.c:67: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((void*)xe, p, hdrsize); data/idevicerestore-1.0.0/src/fls.c:77: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((void*)xe, p, hdrsize); data/idevicerestore-1.0.0/src/fls.c:113: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(fls->data, data, size); data/idevicerestore-1.0.0/src/fls.c:178: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(newdata+offset+hdrsize, ((fls_0c_element*)fls->elements[i])->data, firstpartlen); data/idevicerestore-1.0.0/src/fls.c:180: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(newdata+offset+hdrsize+firstpartlen, sigdata, siglen); data/idevicerestore-1.0.0/src/fls.c:186: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(newdata+offset+hdrsize+0x10, &(((fls_0c_element*)fls->elements[i])->data_size), 4); data/idevicerestore-1.0.0/src/fls.c:188: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(newdata+offset, fls->elements[i], hdrsize); data/idevicerestore-1.0.0/src/fls.c:195: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(newdata+offset, fls->elements[i], hdrsize); data/idevicerestore-1.0.0/src/fls.c:198: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(newdata+offset+hdrsize, ((fls_10_element*)fls->elements[i])->data, fls->elements[i]->size - hdrsize); data/idevicerestore-1.0.0/src/fls.c:209: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(newdata+offset, fls->elements[i], hdrsize); data/idevicerestore-1.0.0/src/fls.c:212: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(newdata+offset+hdrsize, ((fls_14_element*)fls->elements[i])->data, fls->elements[i]->size - hdrsize); data/idevicerestore-1.0.0/src/fls.c:221: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(newdata+offset, fls->elements[i], hdrsize); data/idevicerestore-1.0.0/src/fls.c:224: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(newdata+offset+hdrsize, fls->elements[i]->data, fls->elements[i]->size - hdrsize); data/idevicerestore-1.0.0/src/fls.c:274: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(newdata+offset+hdrsize, data, size); data/idevicerestore-1.0.0/src/fls.c:280: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(newdata+offset+hdrsize+size+padding, ((fls_0c_element*)fls->elements[i])->data, fls->elements[i]->size); data/idevicerestore-1.0.0/src/fls.c:285: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(newdata+offset, fls->elements[i], hdrsize); data/idevicerestore-1.0.0/src/fls.c:292: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(newdata+offset, fls->elements[i], hdrsize); data/idevicerestore-1.0.0/src/fls.c:295: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(newdata+offset+hdrsize, ((fls_10_element*)fls->elements[i])->data, fls->elements[i]->size - hdrsize); data/idevicerestore-1.0.0/src/fls.c:306: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(newdata+offset, fls->elements[i], hdrsize); data/idevicerestore-1.0.0/src/fls.c:309: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(newdata+offset+hdrsize, ((fls_14_element*)fls->elements[i])->data, fls->elements[i]->size - hdrsize); data/idevicerestore-1.0.0/src/fls.c:318: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(newdata+offset, fls->elements[i], hdrsize); data/idevicerestore-1.0.0/src/fls.c:321: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(newdata+offset+hdrsize, fls->elements[i]->data, fls->elements[i]->size - hdrsize); data/idevicerestore-1.0.0/src/ftab.c:50: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(&ftab_new->header, data, sizeof(struct ftab_header)); data/idevicerestore-1.0.0/src/ftab.c:63: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(ftab_new->entries, data + sizeof(struct ftab_header), sizeof(struct ftab_entry) * ftab_new->header.num_entries); data/idevicerestore-1.0.0/src/ftab.c:76: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(ftab_new->storage[i], data + ftab_new->entries[i].offset, ftab_new->entries[i].size); data/idevicerestore-1.0.0/src/ftab.c:126: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(data_copy, data, data_size); data/idevicerestore-1.0.0/src/ftab.c:176: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(p, ftab->storage[i], ftab->entries[i].size); data/idevicerestore-1.0.0/src/idevicerestore.c:151: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 version_xml[1024]; data/idevicerestore-1.0.0/src/idevicerestore.c:165: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 version_xml_tmp[1024]; data/idevicerestore-1.0.0/src/idevicerestore.c:167:3: [2] (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). Risk is low because the source is a constant string. strcat(version_xml_tmp, ".tmp"); data/idevicerestore-1.0.0/src/idevicerestore.c:356: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 wtfname[256]; data/idevicerestore-1.0.0/src/idevicerestore.c:357:3: [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(wtfname, "Firmware/dfu/WTF.s5l%04xxall.RELEASE.dfu", cpid); data/idevicerestore-1.0.0/src/idevicerestore.c:386:4: [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 wtfipsw[1024]; data/idevicerestore-1.0.0/src/idevicerestore.c:468: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 fwsha1[20]; data/idevicerestore-1.0.0/src/idevicerestore.c:499: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 input[64]; data/idevicerestore-1.0.0/src/idevicerestore.c:660:4: [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 tmpstr[256]; data/idevicerestore-1.0.0/src/idevicerestore.c:661:4: [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 p_all_flash[128]; data/idevicerestore-1.0.0/src/idevicerestore.c:662:4: [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 lcmodel[8]; data/idevicerestore-1.0.0/src/idevicerestore.c:672:4: [2] (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). Risk is low because the source is a constant string. strcat(tmpstr, "/manifest"); data/idevicerestore-1.0.0/src/idevicerestore.c:675:4: [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 *files[16]; data/idevicerestore-1.0.0/src/idevicerestore.c:739: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 tt[4]; data/idevicerestore-1.0.0/src/idevicerestore.c:829: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 input[64]; data/idevicerestore-1.0.0/src/idevicerestore.c:830: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 spaces[16]; data/idevicerestore-1.0.0/src/idevicerestore.c:865: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 input[64]; data/idevicerestore-1.0.0/src/idevicerestore.c:913: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 tmpf[1024]; data/idevicerestore-1.0.0/src/idevicerestore.c:956: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 extfn[1024]; data/idevicerestore-1.0.0/src/idevicerestore.c:958:3: [2] (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). Risk is low because the source is a constant string. strcat(extfn, ".extract"); data/idevicerestore-1.0.0/src/idevicerestore.c:959: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 lockfn[1024]; data/idevicerestore-1.0.0/src/idevicerestore.c:961:3: [2] (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). Risk is low because the source is a constant string. strcat(lockfn, ".lock"); data/idevicerestore-1.0.0/src/idevicerestore.c:967:11: [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). extf = fopen(extfn, "wb"); data/idevicerestore-1.0.0/src/idevicerestore.c:1108: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 zfn[1024]; data/idevicerestore-1.0.0/src/idevicerestore.c:1111:6: [2] (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). Risk is low because the source is a constant string. strcat(zfn, "/shsh"); data/idevicerestore-1.0.0/src/idevicerestore.c:1113:6: [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(zfn, "shsh"); data/idevicerestore-1.0.0/src/idevicerestore.c:2061: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 zfn[1024]; data/idevicerestore-1.0.0/src/idevicerestore.c:2352: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(stitched_component, component_data, component_size); data/idevicerestore-1.0.0/src/img3.c:61: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(image->header, data, sizeof(img3_header)); data/idevicerestore-1.0.0/src/img3.c:218: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(element->data, data, element_header->full_size); data/idevicerestore-1.0.0/src/img3.c:385: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(&data[offset], image->elements[i]->data, image->elements[i]->header->full_size); data/idevicerestore-1.0.0/src/img4.c:114:11: [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 buf[6]; data/idevicerestore-1.0.0/src/img4.c:127: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(*data, buf, off); data/idevicerestore-1.0.0/src/img4.c:168: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(*p, str, len); data/idevicerestore-1.0.0/src/img4.c:175: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(*p, data, data_len); data/idevicerestore-1.0.0/src/img4.c:198: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(*p, data, data_len); data/idevicerestore-1.0.0/src/img4.c:384: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((void*)tag, "rkrn", 4); data/idevicerestore-1.0.0/src/img4.c:386: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((void*)tag, "rdtr", 4); data/idevicerestore-1.0.0/src/img4.c:388: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((void*)tag, "rsep", 4); data/idevicerestore-1.0.0/src/img4.c:390: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((void*)tag, "rlgo", 4); data/idevicerestore-1.0.0/src/img4.c:392: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((void*)tag, "rtsc", 4); data/idevicerestore-1.0.0/src/img4.c:424: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(p, img4header, img4header_size); data/idevicerestore-1.0.0/src/img4.c:426: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(p, magic_header, magic_header_size); data/idevicerestore-1.0.0/src/img4.c:428: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(p, IMG4_MAGIC, IMG4_MAGIC_SIZE); data/idevicerestore-1.0.0/src/img4.c:430: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(p, component_data, component_size); data/idevicerestore-1.0.0/src/img4.c:432: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(p, blob_header, blob_header_size); data/idevicerestore-1.0.0/src/img4.c:434: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(p, blob, blob_size); data/idevicerestore-1.0.0/src/img4.c:504:11: [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 tmp_[512] = { 0, }; data/idevicerestore-1.0.0/src/img4.c:566: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(inner_start, tmp_, tmp_len); data/idevicerestore-1.0.0/src/img4.c:603:11: [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 tmp_[1024]; data/idevicerestore-1.0.0/src/img4.c:652:11: [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 manb_[32]; data/idevicerestore-1.0.0/src/img4.c:658:11: [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 inner_set_[8]; data/idevicerestore-1.0.0/src/img4.c:664:11: [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 hdrdata_[16]; data/idevicerestore-1.0.0/src/img4.c:672:11: [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 seq_[8]; data/idevicerestore-1.0.0/src/img4.c:685: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(hdr, seq_, seq_len); data/idevicerestore-1.0.0/src/img4.c:689: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(hdr, hdrdata_, hdrdata_len); data/idevicerestore-1.0.0/src/img4.c:693: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(hdr, inner_set_, inner_set_len); data/idevicerestore-1.0.0/src/img4.c:697: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(hdr, manb_, manb_len); data/idevicerestore-1.0.0/src/ipsw.c:72: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(fullpath, path, plen); data/idevicerestore-1.0.0/src/ipsw.c:74: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(fullpath+plen+1, file, flen); data/idevicerestore-1.0.0/src/ipsw.c:196: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). FILE* fd = fopen(outfile, "wb"); data/idevicerestore-1.0.0/src/ipsw.c:235: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 actual_filepath[PATH_MAX+1]; data/idevicerestore-1.0.0/src/ipsw.c:236: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 actual_outfile[PATH_MAX+1]; data/idevicerestore-1.0.0/src/ipsw.c:250:16: [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). FILE *fi = fopen(actual_filepath, "rb"); data/idevicerestore-1.0.0/src/ipsw.c:263:16: [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). FILE *fo = fopen(actual_outfile, "wb"); data/idevicerestore-1.0.0/src/ipsw.c:406: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). FILE *f = fopen(filepath, "rb"); data/idevicerestore-1.0.0/src/ipsw.c:508: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 url[256]; data/idevicerestore-1.0.0/src/ipsw.c:608: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 majstr[32]; // should be enough for a uint64_t value data/idevicerestore-1.0.0/src/ipsw.c:692:11: [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 tsha1[20]; data/idevicerestore-1.0.0/src/ipsw.c:693: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[8192]; data/idevicerestore-1.0.0/src/ipsw.c:715: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 fwlfn[PATH_MAX - 5]; data/idevicerestore-1.0.0/src/ipsw.c:722: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 fwlock[PATH_MAX]; data/idevicerestore-1.0.0/src/ipsw.c:732:11: [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 zsha1[20] = {0, }; data/idevicerestore-1.0.0/src/ipsw.c:733:12: [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). FILE* f = fopen(fwlfn, "rb"); data/idevicerestore-1.0.0/src/ipsw.c:760: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). FILE* f = fopen(fwlfn, "rb"); data/idevicerestore-1.0.0/src/ipsw.c:794:11: [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 isha1[20]; data/idevicerestore-1.0.0/src/json_plist.c:39: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(str, js + token.start, len); data/idevicerestore-1.0.0/src/limera1n.c:52:11: [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 buf[0x800]; data/idevicerestore-1.0.0/src/limera1n.c:53:11: [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 shellcode[0x800]; data/idevicerestore-1.0.0/src/limera1n.c:86: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(shellcode, limera1n_payload, sizeof(limera1n_payload)); data/idevicerestore-1.0.0/src/locking.c:52:17: [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). lockinfo->fp = fopen(filename, "a+"); data/idevicerestore-1.0.0/src/mbn.c:37: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(mbn->data, data, size); data/idevicerestore-1.0.0/src/mbn.c:41: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(&mbn->header.v2, data, sizeof(mbn_header_v2)); data/idevicerestore-1.0.0/src/mbn.c:45: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(&mbn->header.v1, data, sizeof(mbn_header_v1)); data/idevicerestore-1.0.0/src/mbn.c:49: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(&mbn->header.bin, data, sizeof(bin_header)); data/idevicerestore-1.0.0/src/mbn.c:53: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(&mbn->header.elf, data, sizeof(elf_header)); data/idevicerestore-1.0.0/src/mbn.c:87: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(mbn->data + mbn->parsed_sig_offset, sigdata, siglen); data/idevicerestore-1.0.0/src/mbn.h:47:11: [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 magic1[8]; data/idevicerestore-1.0.0/src/mbn.h:73:11: [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 magic[8]; data/idevicerestore-1.0.0/src/mbn.h:85:11: [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 magic[8]; data/idevicerestore-1.0.0/src/recovery.c:509: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 setba[256]; data/idevicerestore-1.0.0/src/recovery.c:510:3: [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(setba, "setenv boot-args "); data/idevicerestore-1.0.0/src/recovery.c:575: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(*nonce, device_info->ap_nonce, *nonce_size); data/idevicerestore-1.0.0/src/recovery.c:599: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(*nonce, device_info->sep_nonce, *nonce_size); data/idevicerestore-1.0.0/src/restore.c:945: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 compkeyname[256]; data/idevicerestore-1.0.0/src/restore.c:968: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 firmware_path[PATH_MAX - 9]; data/idevicerestore-1.0.0/src/restore.c:969: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 manifest_file[PATH_MAX]; data/idevicerestore-1.0.0/src/restore.c:972: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 firmware_filename[PATH_MAX]; data/idevicerestore-1.0.0/src/restore.c:1004: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(firmware_path, llb_path, (llb_filename - 1) - llb_path); data/idevicerestore-1.0.0/src/restore.c:1407: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(fdata, fls->data, fsize); data/idevicerestore-1.0.0/src/restore.c:1411: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(fdata, mbn->data, fsize); data/idevicerestore-1.0.0/src/restore.c:1531: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(fdata, fls->data, fsize); data/idevicerestore-1.0.0/src/restore.c:1709:3: [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(bbfwtmp, "bbfw_"); data/idevicerestore-1.0.0/src/restore.c:1711:3: [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(bbfwtmp + 5 + l, ".tmp"); data/idevicerestore-1.0.0/src/sha1.c:55: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. const unsigned char buffer[64] data/idevicerestore-1.0.0/src/sha1.c:62:18: [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 c[64]; data/idevicerestore-1.0.0/src/sha1.c:69: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(block, buffer, 64); data/idevicerestore-1.0.0/src/sha1.c:214:9: [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(&context->buffer[j], data, (i = 64 - j)); data/idevicerestore-1.0.0/src/sha1.c:224: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(&context->buffer[j], &data[i], len - i); data/idevicerestore-1.0.0/src/sha1.c:231: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 digest[20], data/idevicerestore-1.0.0/src/sha1.c:237: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 finalcount[8]; data/idevicerestore-1.0.0/src/sha1.h:16: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[64]; data/idevicerestore-1.0.0/src/sha1.h:21: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. const unsigned char buffer[64] data/idevicerestore-1.0.0/src/sha1.h:35: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 digest[20], data/idevicerestore-1.0.0/src/tss.c:1383: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(response->content + response->length, data, total); data/idevicerestore-1.0.0/src/tss.c:1402: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 curl_error_message[CURL_ERROR_SIZE]; data/idevicerestore-1.0.0/src/common.c:151: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). while ((strlen(idevicerestore_err_buff) > 0) && (p = strrchr(idevicerestore_err_buff, '\n'))) { data/idevicerestore-1.0.0/src/common.c:334: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 (tmpl); data/idevicerestore-1.0.0/src/common.c:441: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). lt = strlen(tmpdir); data/idevicerestore-1.0.0/src/common.c:445: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). lp = strlen(prefix); data/idevicerestore-1.0.0/src/common.c:453:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(result + lt, prefix, lp); data/idevicerestore-1.0.0/src/common.c:522:7: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getchar(); data/idevicerestore-1.0.0/src/common.h:147:21: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. #define __usleep(x) usleep(x) data/idevicerestore-1.0.0/src/idevicerestore.c:158:3: [1] (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). Risk is low because the source is a constant character. strcat(version_xml, "/"); data/idevicerestore-1.0.0/src/idevicerestore.c:392:5: [1] (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). Risk is low because the source is a constant character. strcat(wtfipsw, "/"); data/idevicerestore-1.0.0/src/idevicerestore.c:542: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). if (strlen(s_sha1) == 40) { data/idevicerestore-1.0.0/src/idevicerestore.c:699:5: [1] (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). Risk is low because the source is a constant character. strcat(tmpstr, "/"); data/idevicerestore-1.0.0/src/idevicerestore.c:740:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tt, lcmodel, 3); data/idevicerestore-1.0.0/src/idevicerestore.c:831:27: [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 num_spaces = 13 - strlen(client->version) - strlen(device_version); data/idevicerestore-1.0.0/src/idevicerestore.c:831:53: [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 num_spaces = 13 - strlen(client->version) - strlen(device_version); data/idevicerestore-1.0.0/src/idevicerestore.c:919:3: [1] (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). Risk is low because the source is a constant character. strcat(tmpf, "/"); data/idevicerestore-1.0.0/src/idevicerestore.c:929: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). char* s = tmpf + strlen(tmpf) - 1; data/idevicerestore-1.0.0/src/idevicerestore.c:942:2: [1] (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). Risk is low because the source is a constant character. strcat(tmpf, "/"); data/idevicerestore-1.0.0/src/idevicerestore.c:1116: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). sprintf(zfn+strlen(zfn), "/%" PRIu64 "-%s-%s.shsh", client->ecid, client->device->product_type, client->version); data/idevicerestore-1.0.0/src/img4.c:165: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). size_t len = (data_len < 0) ? strlen(str) : data_len; data/idevicerestore-1.0.0/src/ipsw.c:66:16: [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). size_t plen = strlen(path); data/idevicerestore-1.0.0/src/ipsw.c:67:16: [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). size_t flen = strlen(file); data/idevicerestore-1.0.0/src/ipsw.c:673: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(strval) == 40) { data/idevicerestore-1.0.0/src/restore.c:1316:30: [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 (node && (strcmp(key + (strlen(key) - 5), "-Blob") == 0) && (plist_get_node_type(node) == PLIST_DATA)) { data/idevicerestore-1.0.0/src/restore.c:1707: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). size_t l = strlen(client->udid); data/idevicerestore-1.0.0/src/restore.c:1710:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(bbfwtmp + 5, client->udid, l); data/idevicerestore-1.0.0/src/socket.c:71:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name.sun_path, filename, sizeof(name.sun_path)); data/idevicerestore-1.0.0/src/socket.c:82:6: [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). + strlen(name.sun_path) + 1); data/idevicerestore-1.0.0/src/socket.c:128:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name.sun_path, filename, sizeof(name.sun_path)); data/idevicerestore-1.0.0/src/socket.c:132:6: [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). + strlen(name.sun_path) + 1); data/idevicerestore-1.0.0/src/tss.c:1448: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). curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE, strlen(request)); data/idevicerestore-1.0.0/src/tss.c:1507:60: [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* message = strstr(response->content, "MESSAGE=") + strlen("MESSAGE="); ANALYSIS SUMMARY: Hits = 250 Lines analyzed = 16786 in approximately 0.46 seconds (36478 lines/second) Physical Source Lines of Code (SLOC) = 13193 Hits@level = [0] 62 [1] 31 [2] 164 [3] 10 [4] 45 [5] 0 Hits@level+ = [0+] 312 [1+] 250 [2+] 219 [3+] 55 [4+] 45 [5+] 0 Hits/KSLOC@level+ = [0+] 23.6489 [1+] 18.9494 [2+] 16.5997 [3+] 4.16888 [4+] 3.4109 [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.