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/libinklevel-0.9.3/bjnp-io.c Examining data/libinklevel-0.9.3/hp.h Examining data/libinklevel-0.9.3/epson.c Examining data/libinklevel-0.9.3/util.c Examining data/libinklevel-0.9.3/hp.c Examining data/libinklevel-0.9.3/libusb-utils.c Examining data/libinklevel-0.9.3/internal.h Examining data/libinklevel-0.9.3/bjnp.h Examining data/libinklevel-0.9.3/bjnp-debug.c Examining data/libinklevel-0.9.3/d4lib.h Examining data/libinklevel-0.9.3/d4lib.c Examining data/libinklevel-0.9.3/printer-io.c Examining data/libinklevel-0.9.3/canon.h Examining data/libinklevel-0.9.3/inklevel.h Examining data/libinklevel-0.9.3/epson.h Examining data/libinklevel-0.9.3/libinklevel.c Examining data/libinklevel-0.9.3/config.h Examining data/libinklevel-0.9.3/devices.c Examining data/libinklevel-0.9.3/util.h Examining data/libinklevel-0.9.3/printer-io.h Examining data/libinklevel-0.9.3/libusb-utils.h Examining data/libinklevel-0.9.3/devices.h Examining data/libinklevel-0.9.3/canon.c FINAL RESULTS: data/libinklevel-0.9.3/bjnp-debug.c:198:3: [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 (printbuf, sizeof (printbuf), fmt, ap); data/libinklevel-0.9.3/bjnp-io.c:185: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 (IEEE1284_id, printer_id); data/libinklevel-0.9.3/bjnp-io.c:223: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 (name, address); data/libinklevel-0.9.3/bjnp-io.c:227: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 (name, myhost->h_name); data/libinklevel-0.9.3/d4lib.c:944: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(buf + sizeof(cmdHeader_t), serviceName); data/libinklevel-0.9.3/d4lib.c:1407: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(buf+1+sizeof(cmdHeader_t), serviceName); data/libinklevel-0.9.3/d4lib.c:1442: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(buf+1+sizeof(replyHeader_t), serviceName); data/libinklevel-0.9.3/bjnp-debug.c:36: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 string[10]; data/libinklevel-0.9.3/bjnp-debug.c:75:16: [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 const char hdigit[16] = data/libinklevel-0.9.3/bjnp-debug.c:134: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 line[100]; /* actually only 1+8+1+8*3+1+8*3+1+4+16 = data/libinklevel-0.9.3/bjnp-debug.c:191: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 printbuf[256]; data/libinklevel-0.9.3/bjnp-debug.c:232: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 loglevel[16]; data/libinklevel-0.9.3/bjnp-debug.c:266:21: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((debug_file = fopen (LOGFILE, "w")) == NULL) data/libinklevel-0.9.3/bjnp-io.c:150: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 printer_id[BJNP_IEEE1284_MAX]; data/libinklevel-0.9.3/bjnp-io.c:153: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 resp_buf[BJNP_RESP_MAX]; data/libinklevel-0.9.3/bjnp-io.c:204: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 (address, "%u.%u.%u.%u", data/libinklevel-0.9.3/bjnp-io.c:310: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 resp_buf[2048]; data/libinklevel-0.9.3/bjnp-io.c:478: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 hostname[HOSTNAME_MAX]; data/libinklevel-0.9.3/bjnp-io.c:554:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char resp_buf[BJNP_RESP_MAX]; data/libinklevel-0.9.3/bjnp-io.c:562: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(&addr, &list[port_number].addr, sizeof(struct sockaddr_in)); data/libinklevel-0.9.3/bjnp.h:66: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 BJNP_id[4]; /* string: BJNP */ data/libinklevel-0.9.3/bjnp.h:79: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 unknown1[6]; /* 00 01 08 00 06 04 */ data/libinklevel-0.9.3/bjnp.h:80: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 mac_addr[6]; /* printers mac address */ data/libinklevel-0.9.3/bjnp.h:81: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 ip_addr[4]; /* printers IP-address */ data/libinklevel-0.9.3/bjnp.h:89: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 unknown[8]; /* don't know what these are for */ data/libinklevel-0.9.3/bjnp.h:90: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 hostname[64]; /* hostname of sender */ data/libinklevel-0.9.3/bjnp.h:91: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 username[64]; /* username */ data/libinklevel-0.9.3/bjnp.h:92: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 jobtitle[256]; /* job title */ data/libinklevel-0.9.3/bjnp.h:101: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 id[2048]; /* identity */ data/libinklevel-0.9.3/bjnp.h:107: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 id[2048]; /* identity */ data/libinklevel-0.9.3/bjnp.h:147: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 ip_address[16]; data/libinklevel-0.9.3/bjnp.h:148: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 hostname[256]; /* hostame, if found, else ip-address */ data/libinklevel-0.9.3/bjnp.h:151: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 model[BJNP_MODEL_MAX]; /* printer make and model */ data/libinklevel-0.9.3/canon.c:77: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 cartridgeTypes[10]; data/libinklevel-0.9.3/canon.c:293: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 command[256]; data/libinklevel-0.9.3/canon.c:296: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 buffer[BUFLEN]; data/libinklevel-0.9.3/canon.c:677: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, cmdHdr, GET_STR_LENGTH(cmdHdr)); data/libinklevel-0.9.3/canon.c:683: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 + dataLen, &length, 1); /* command length, data/libinklevel-0.9.3/canon.c:692: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 + dataLen, cmdSeparator, data/libinklevel-0.9.3/canon.c:701: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 + dataLen + 1, &length, 1); /* command length, data/libinklevel-0.9.3/canon.c:706: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 + dataLen, cmd, cmdLen); data/libinklevel-0.9.3/d4lib.c:556: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 buf[1024]; data/libinklevel-0.9.3/d4lib.c:609:13: [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 header[6]; data/libinklevel-0.9.3/d4lib.c:610:13: [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[1024]; data/libinklevel-0.9.3/d4lib.c:649: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 (buf, buffer + 6, toGet); data/libinklevel-0.9.3/d4lib.c:828:13: [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[200]; data/libinklevel-0.9.3/d4lib.c:876:13: [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[20]; data/libinklevel-0.9.3/d4lib.c:905:13: [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[20]; data/libinklevel-0.9.3/d4lib.c:933: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 buf[100]; data/libinklevel-0.9.3/d4lib.c:934:13: [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 rBuf[100]; data/libinklevel-0.9.3/d4lib.c:971:13: [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 cmd[17]; data/libinklevel-0.9.3/d4lib.c:972:13: [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[20]; data/libinklevel-0.9.3/d4lib.c:1037:13: [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[100]; data/libinklevel-0.9.3/d4lib.c:1067:13: [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[100]; data/libinklevel-0.9.3/d4lib.c:1068:13: [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 rBuf[100]; data/libinklevel-0.9.3/d4lib.c:1109:13: [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[100]; data/libinklevel-0.9.3/d4lib.c:1110:13: [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 rBuf[100]; data/libinklevel-0.9.3/d4lib.c:1203:13: [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 cmd[6]; data/libinklevel-0.9.3/d4lib.c:1233: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(buffer, cmd, 6); data/libinklevel-0.9.3/d4lib.c:1234: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(buffer + 6, buf, len - 6 ); data/libinklevel-0.9.3/d4lib.c:1348:13: [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[20]; data/libinklevel-0.9.3/d4lib.c:1396:13: [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[100]; data/libinklevel-0.9.3/d4lib.c:1414:13: [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[100]; data/libinklevel-0.9.3/d4lib.c:1431:13: [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[100]; data/libinklevel-0.9.3/d4lib.c:1448:13: [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[100]; data/libinklevel-0.9.3/epson.c:46: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 printer_cmd[1025]; data/libinklevel-0.9.3/epson.c:55: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 my_device[256]; data/libinklevel-0.9.3/epson.c:85: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(printer_cmd + bufpos, hdr, sizeof(hdr) - 1); /* DON'T include null! */ data/libinklevel-0.9.3/epson.c:114: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[1024]; data/libinklevel-0.9.3/epson.c:223: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 buf[1024]; data/libinklevel-0.9.3/epson.c:514: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(printer_cmd + bufpos, cmd, 2); data/libinklevel-0.9.3/epson.c:778: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(printer_cmd + bufpos, remote_hdr, sizeof(remote_hdr) - 1); data/libinklevel-0.9.3/epson.c:788: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(printer_cmd + bufpos, remote_trailer, sizeof(remote_trailer) - 1); data/libinklevel-0.9.3/hp.c:22:28: [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. int parse_device_id_new_hp(char tags[NR_TAGS][BUFLEN], int n, data/libinklevel-0.9.3/hp.c:27: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 colorsAscii[2]; data/libinklevel-0.9.3/hp.c:32: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 colorTypeAscii[3]; data/libinklevel-0.9.3/hp.c:34: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 colorValueAscii[3]; data/libinklevel-0.9.3/hp.c:37: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 black[3]; data/libinklevel-0.9.3/hp.c:38: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 cyan[3]; data/libinklevel-0.9.3/hp.c:39: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 magenta[3]; data/libinklevel-0.9.3/hp.c:40: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 yellow[3]; data/libinklevel-0.9.3/hp.c:130:12: [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). colors = atoi(colorsAscii); data/libinklevel-0.9.3/hp.c:292:28: [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. int parse_device_id_old_hp(char tags[NR_TAGS][BUFLEN], int n, data/libinklevel-0.9.3/hp.c:296: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 b[4]; /* level of black ink as decimal string */ data/libinklevel-0.9.3/hp.c:297: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 c[4]; /* level of color ink as decimal string */ data/libinklevel-0.9.3/hp.h:14:28: [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. int parse_device_id_old_hp(char tags[NR_TAGS][BUFLEN], int n, data/libinklevel-0.9.3/hp.h:17:28: [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. int parse_device_id_new_hp(char tags[NR_TAGS][BUFLEN], int n, data/libinklevel-0.9.3/inklevel.h:96: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 model[MODEL_NAME_LENGTH]; data/libinklevel-0.9.3/libinklevel.c:29: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 device_id[BUFLEN]; data/libinklevel-0.9.3/libinklevel.c:60: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 tags[NR_TAGS][BUFLEN]; data/libinklevel-0.9.3/util.c:257:31: [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. void tokenize_device_id(const char *string, char tags[NR_TAGS][BUFLEN]) { data/libinklevel-0.9.3/util.c:257:45: [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. void tokenize_device_id(const char *string, char tags[NR_TAGS][BUFLEN]) { data/libinklevel-0.9.3/util.c:302:1: [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 *get_tag_value(char tags[NR_TAGS][BUFLEN], char *tag) data/libinklevel-0.9.3/util.c:302:21: [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 *get_tag_value(char tags[NR_TAGS][BUFLEN], char *tag) data/libinklevel-0.9.3/util.c:328:19: [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. int get_tag_index(char tags[NR_TAGS][BUFLEN], char *tag) { data/libinklevel-0.9.3/util.h:17:31: [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. void tokenize_device_id(const char *string, char tags[NR_TAGS][BUFLEN]); data/libinklevel-0.9.3/util.h:17:45: [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. void tokenize_device_id(const char *string, char tags[NR_TAGS][BUFLEN]); data/libinklevel-0.9.3/util.h:18:1: [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 *get_tag_value(char tags[NR_TAGS][BUFLEN], char *tag); data/libinklevel-0.9.3/util.h:18:21: [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 *get_tag_value(char tags[NR_TAGS][BUFLEN], char *tag); data/libinklevel-0.9.3/util.h:19:19: [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. int get_tag_index(char tags[NR_TAGS][BUFLEN], char *tag); data/libinklevel-0.9.3/bjnp-debug.c:119:15: [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). for (i = 0; strlen (logtable[i].string) != 0; i++) data/libinklevel-0.9.3/bjnp-debug.c:250: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). if (strlen (separator) > 0) data/libinklevel-0.9.3/bjnp-debug.c:262:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (loglevel, level, 15); data/libinklevel-0.9.3/bjnp-io.c:63:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (cmd->BJNP_id, BJNP_STRING, sizeof (cmd->BJNP_id)); data/libinklevel-0.9.3/bjnp-io.c:157:3: [1] (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 character. strcpy (IEEE1284_id, ""); data/libinklevel-0.9.3/bjnp-io.c:179:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (printer_id, id->id, id_len); data/libinklevel-0.9.3/bjnp-io.c:487:32: [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 ((device_uri == NULL) || (strlen(device_uri) == 0)) data/libinklevel-0.9.3/bjnp-io.c:570:3: [1] (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 character. strcpy (status, ""); data/libinklevel-0.9.3/bjnp-io.c:591:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (status, idn->id, id_len); data/libinklevel-0.9.3/bjnp-io.c:595:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (status, id->id, id_len); data/libinklevel-0.9.3/canon.c:599:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(existingPrinters[mdl].chdTypes[i].chd))) { data/libinklevel-0.9.3/canon.c:656:25: [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). sscanf(cart_level+strlen(cartridges[i].key), data/libinklevel-0.9.3/d4lib.c:274:2: [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. usleep(d4WrTimeout); data/libinklevel-0.9.3/d4lib.c:398:4: [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. usleep(1); /* according to Glen Steward, this will solve problems */ data/libinklevel-0.9.3/d4lib.c:457:4: [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. usleep(d4RdTimeout); data/libinklevel-0.9.3/d4lib.c:527:7: [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. usleep(d4RdTimeout); data/libinklevel-0.9.3/d4lib.c:559:4: [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. usleep(d4RdTimeout); data/libinklevel-0.9.3/d4lib.c:572:8: [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. usleep(d4RdTimeout); data/libinklevel-0.9.3/d4lib.c:932:36: [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 len = sizeof(cmdHeader_t) + strlen(serviceName); data/libinklevel-0.9.3/d4lib.c:1161:10: [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. usleep(d4RdTimeout); data/libinklevel-0.9.3/d4lib.c:1299:7: [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. usleep(1000); data/libinklevel-0.9.3/d4lib.c:1332:5: [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. usleep(1000); data/libinklevel-0.9.3/d4lib.c:1395:42: [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 len = sizeof(replyHeader_t) + 1 + strlen(serviceName); data/libinklevel-0.9.3/d4lib.c:1430:42: [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 len = sizeof(replyHeader_t) + 1 + strlen(serviceName); data/libinklevel-0.9.3/epson.c:65:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(my_device, device_file, 255); data/libinklevel-0.9.3/epson.c:797:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (!strncmp(buf, cmd, strlen(cmd))) { data/libinklevel-0.9.3/epson.c:798:32: [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). const char *answer = buf + strlen(cmd); data/libinklevel-0.9.3/libinklevel.c:100:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(level->model, c, MODEL_NAME_LENGTH-1); data/libinklevel-0.9.3/libinklevel.c:107:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(level->model) < MODEL_NAME_LENGTH-1){ data/libinklevel-0.9.3/libinklevel.c:108: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(level->model, " "); data/libinklevel-0.9.3/libinklevel.c:113:5: [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(level->model, c, MODEL_NAME_LENGTH -1 - strlen(level->model)); data/libinklevel-0.9.3/libinklevel.c:113: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). strncat(level->model, c, MODEL_NAME_LENGTH -1 - strlen(level->model)); data/libinklevel-0.9.3/util.c:306:31: [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 (strncmp(tags[i], tag, strlen(tag)) == 0){ data/libinklevel-0.9.3/util.c:312:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return tags[i] + strlen(tag); data/libinklevel-0.9.3/util.c:331:31: [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 (strncmp(tags[i], tag, strlen(tag)) == 0){ ANALYSIS SUMMARY: Hits = 135 Lines analyzed = 6422 in approximately 0.25 seconds (25932 lines/second) Physical Source Lines of Code (SLOC) = 4263 Hits@level = [0] 182 [1] 35 [2] 93 [3] 0 [4] 7 [5] 0 Hits@level+ = [0+] 317 [1+] 135 [2+] 100 [3+] 7 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 74.3608 [1+] 31.6678 [2+] 23.4577 [3+] 1.64204 [4+] 1.64204 [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.