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/bandwidthd-2.0.1+cvs20090917/pgsql.c Examining data/bandwidthd-2.0.1+cvs20090917/extensions.c Examining data/bandwidthd-2.0.1+cvs20090917/graph.c Examining data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c Examining data/bandwidthd-2.0.1+cvs20090917/bandwidthd.h FINAL RESULTS: data/bandwidthd-2.0.1+cvs20090917/extensions.c:31:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/%s", EXTENSION_DIR, namelist[Counter]->d_name); data/bandwidthd-2.0.1+cvs20090917/extensions.c:80:9: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execl(filename, filename, config.dev, NULL); data/bandwidthd-2.0.1+cvs20090917/extensions.c:112:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ptr, "%s%s", res, buffer); data/bandwidthd-2.0.1+cvs20090917/extensions.c:118:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ptr, "%s", buffer); data/bandwidthd-2.0.1+cvs20090917/graph.c:64:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(Buffer, "%s", hostent->h_name); data/bandwidthd-2.0.1+cvs20090917/graph.c:444:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/htdocs/%s-%c-R.png", config.htdocs_dir, CharIp, config.tag); data/bandwidthd-2.0.1+cvs20090917/graph.c:446:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/htdocs/%s-%c-S.png", config.htdocs_dir, CharIp, config.tag); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:701:11: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. ptr += sprintf(ptr, "%s, ", extptr->name); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:89: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 FileName[4][MAX_FILENAME]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:100: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). index = fopen(FileName[Counter], "wt"); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:234: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). pidfile = fopen("/var/run/bandwidthd.pid", "wt"); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:276: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 Error[PCAP_ERRBUF_SIZE]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:369: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). bdconfig_in = fopen(bd_conf, "rt"); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:381: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 subnet[16], mask[16]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:575: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[SNAPLEN]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:576: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 enet_broadcast[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:592:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&buf[0], enet_broadcast, 6); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:593:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&buf[6], enet_broadcast, 6); // Would rather use our own mac address data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:597: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(buf+14, config.sensor_name, strlen(config.sensor_name)+1); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:598: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(buf+14+strlen(config.sensor_name)+1, config.dev, strlen(config.dev)+1); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:904: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 IPBuffer[50]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:905: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 logfile[MAX_FILENAME]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:909: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). cdf = fopen(logfile, "at"); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:964:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&DataStoreBlock->Data[DataStoreBlock->NumEntries++], IPData, sizeof(struct IPData)); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1021: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 logname1[MAX_FILENAME]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1022: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 logname2[MAX_FILENAME]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1074: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). fclose(fopen(logname1, "at")); // Touch file data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1104: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 ipaddrBuffer[16]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1107:14: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(cdf = fopen(filename, "rt"))) data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1132: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 ipaddrBuffer[16]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1174: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 ipaddrBuffer[16]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1220: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 logname[MAX_FILENAME]; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1238:14: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((cdf = fopen(logname, "rt"))) data/bandwidthd-2.0.1+cvs20090917/extensions.c:59:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[1500]; data/bandwidthd-2.0.1+cvs20090917/graph.c:35: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 chrIP[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:137: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 Buffer1[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:138: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 Buffer2[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:139: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 Buffer3[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:140: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 Buffer4[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:141: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 Buffer4b[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:142: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 Buffer5[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:143: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 Buffer5b[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:144: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 Buffer5c[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:145: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 Buffer6[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:146: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 Buffer7[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:147: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 Buffer8[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:151: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(Buffer1, "Total"); data/bandwidthd-2.0.1+cvs20090917/graph.c:206: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 filename[MAX_FILENAME]; data/bandwidthd-2.0.1+cvs20090917/graph.c:211: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 Buffer1[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:212: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 Buffer2[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:213: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 HostName[255]; data/bandwidthd-2.0.1+cvs20090917/graph.c:225: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). if ((file = fopen(filename, "wt")) == NULL) data/bandwidthd-2.0.1+cvs20090917/graph.c:234: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). if ((file = fopen(filename, "wt")) == NULL) data/bandwidthd-2.0.1+cvs20090917/graph.c:294:5: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(Buffer1, "Total"); data/bandwidthd-2.0.1+cvs20090917/graph.c:295:5: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(HostName, "Total of all subnets"); data/bandwidthd-2.0.1+cvs20090917/graph.c:316: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). if ((file = fopen(filename, "wt")) == NULL) data/bandwidthd-2.0.1+cvs20090917/graph.c:388: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 filename[MAX_FILENAME]; data/bandwidthd-2.0.1+cvs20090917/graph.c:392: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 CharIp[20]; data/bandwidthd-2.0.1+cvs20090917/graph.c:399: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(CharIp, "Total"); data/bandwidthd-2.0.1+cvs20090917/graph.c:424:27: [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 ((OutputFile = fopen(filename, "wb")) == NULL) data/bandwidthd-2.0.1+cvs20090917/graph.c:433:27: [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 ((OutputFile = fopen(filename, "wb")) == NULL) data/bandwidthd-2.0.1+cvs20090917/graph.c:488:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char Buffer[30]; data/bandwidthd-2.0.1+cvs20090917/graph.c:489: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 Buffer2[50]; data/bandwidthd-2.0.1+cvs20090917/graph.c:753:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[20]; data/bandwidthd-2.0.1+cvs20090917/graph.c:803:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[100]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:185: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. const char *paramValues[3]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:186: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 Values[2][MAX_PARAM_SIZE]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:225: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. const char *paramValues[3]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:226: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 Values[3][MAX_PARAM_SIZE]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:275: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. const char *paramValues[3]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:276: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 Values[3][MAX_PARAM_SIZE]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:315:7: [2] (integer) atol: 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). if (atol(PQcmdTuples(res)) > 0) data/bandwidthd-2.0.1+cvs20090917/pgsql.c:349: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. const char *paramValues[5]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:350: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 Values[5][MAX_PARAM_SIZE]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:388: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. const char *paramValues[1]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:389: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 Values[1][MAX_PARAM_SIZE]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:426:9: [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 sensor_id[MAX_PARAM_SIZE] = { '\0' }; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:434: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 now[MAX_PARAM_SIZE]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:436: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. const char *paramValues[22]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:439: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 Values[13][MAX_PARAM_SIZE]; data/bandwidthd-2.0.1+cvs20090917/pgsql.c:698:10: [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. ptr += sprintf(ptr, "INSERT INTO extension_log (sensor_id, timestamp, "); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:706:10: [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. ptr += sprintf(ptr, ") VALUES ($1, $2, "); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:709:11: [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. ptr += sprintf(ptr, "$%d, ", Counter+3); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:712:10: [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. ptr += sprintf(ptr, ");"); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:384:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(subnet, inet_ntoa(addr), 16); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:385:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(mask, inet_ntoa(addr2), 16); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:582:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((14+strlen(config.sensor_name)+strlen(config.dev)) > SNAPLEN) data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:582:37: [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 ((14+strlen(config.sensor_name)+strlen(config.dev)) > SNAPLEN) data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:597:37: [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). memcpy(buf+14, config.sensor_name, strlen(config.sensor_name)+1); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:598: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). memcpy(buf+14+strlen(config.sensor_name)+1, config.dev, strlen(config.dev)+1); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:598:58: [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). memcpy(buf+14+strlen(config.sensor_name)+1, config.dev, strlen(config.dev)+1); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:613: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). interface = p+strlen(p)+1; data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:616: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). if (strlen(sensor_name) > SNAPLEN || strlen(interface) > SNAPLEN) data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:616:39: [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(sensor_name) > SNAPLEN || strlen(interface) > SNAPLEN) data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1110:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (fgetc(cdf) != '\n') // rewind to last newline data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1147:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (fgetc(cdf) != '\n' && !feof(cdf)); // Read to next line data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1155:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (fgetc(cdf) != '\n' && !feof(cdf)); data/bandwidthd-2.0.1+cvs20090917/bandwidthd.c:1287:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, s, 16); data/bandwidthd-2.0.1+cvs20090917/extensions.c:30:22: [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). filename = malloc(strlen(EXTENSION_DIR)+strlen(namelist[Counter]->d_name)+2); data/bandwidthd-2.0.1+cvs20090917/extensions.c:30:44: [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). filename = malloc(strlen(EXTENSION_DIR)+strlen(namelist[Counter]->d_name)+2); data/bandwidthd-2.0.1+cvs20090917/extensions.c:106:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(ExtPipe[0], buffer, 1499); data/bandwidthd-2.0.1+cvs20090917/extensions.c:111:18: [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). ptr = malloc(strlen(res)+len+1); data/bandwidthd-2.0.1+cvs20090917/extensions.c:126: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). for(Counter = strlen(res)-1; Counter >= 0; Counter--) data/bandwidthd-2.0.1+cvs20090917/extensions.c:135: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). if (strlen(res) < 1) data/bandwidthd-2.0.1+cvs20090917/graph.c:52:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Buffer, TooManyDNSTimeouts, 253); data/bandwidthd-2.0.1+cvs20090917/graph.c:67:10: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Buffer, None, 253); data/bandwidthd-2.0.1+cvs20090917/graph.c:76:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Buffer, DNSError, 253); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:192:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[0], sensor_name, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:193:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[1], interface, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:212:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sensor_id, PQgetvalue(res, 0, 0), MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:242:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sensor_id, PQgetvalue(res, 0, 0), MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:245:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[0], config.sensor_name, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:246:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[1], config.dev, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:247:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[2], sensor_id, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:285:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[0], sensor_id, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:359:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[0], sensor_id, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:360:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[1], config.description, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:361:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[2], config.management_url, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:394:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[0], sensor_id, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:573:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(now, PQgetvalue(res, 0, 0), MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:579:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[0], sensor_id, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:580:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Values[1], now, MAX_PARAM_SIZE); data/bandwidthd-2.0.1+cvs20090917/pgsql.c:677: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). len += strlen(extptr->name)+6; ANALYSIS SUMMARY: Hits = 123 Lines analyzed = 3459 in approximately 0.13 seconds (26352 lines/second) Physical Source Lines of Code (SLOC) = 2750 Hits@level = [0] 219 [1] 39 [2] 76 [3] 0 [4] 8 [5] 0 Hits@level+ = [0+] 342 [1+] 123 [2+] 84 [3+] 8 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 124.364 [1+] 44.7273 [2+] 30.5455 [3+] 2.90909 [4+] 2.90909 [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.