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/lpc21isp-1.97/adprog.c
Examining data/lpc21isp-1.97/adprog.h
Examining data/lpc21isp-1.97/lpc21isp.h
Examining data/lpc21isp-1.97/lpcterm.c
Examining data/lpc21isp-1.97/lpcterm.h
Examining data/lpc21isp-1.97/StdAfx.h
Examining data/lpc21isp-1.97/lpc21isp.c
Examining data/lpc21isp-1.97/lpcprog.c
Examining data/lpc21isp-1.97/lpcprog.h

FINAL RESULTS:

data/lpc21isp-1.97/lpc21isp.c:1178:9:  [4] (format) vsprintf:
  Potential format string problem (CWE-134). Make format string constant.
        vsprintf(pTemp, fmt, ap);
data/lpc21isp-1.97/lpc21isp.c:1244:13:  [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((char *)Answer, residual_data);
data/lpc21isp-1.97/lpc21isp.c:1295:9:  [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(residual_data, (char *)endPtr);
data/lpc21isp-1.97/lpc21isp.h:44:9:  [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.
#define printf iprintf
data/lpc21isp-1.97/lpcprog.c:746:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(temp, "%s\r\n", IspEnvironment->StringOscillator);
data/lpc21isp-1.97/lpcprog.c:752:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(temp, "%s\nOK\n", IspEnvironment->StringOscillator);
data/lpc21isp-1.97/lpc21isp.c:424: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 RxTmpBuf[256];        // save received data to this buffer for half-duplex
data/lpc21isp-1.97/lpc21isp.c:469:23:  [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).
    dcb.BaudRate    = atol(IspEnvironment->baud_rate);
data/lpc21isp-1.97/lpc21isp.c:521:29:  [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).
    IspEnvironment->fdCom = open(IspEnvironment->serial_port, O_RDWR | O_NOCTTY | O_NONBLOCK);
data/lpc21isp-1.97/lpc21isp.c:556:13:  [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).
    switch (atol(IspEnvironment->baud_rate))
data/lpc21isp-1.97/lpc21isp.c:797: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 tmp_string[32];
data/lpc21isp-1.97/lpc21isp.c:857:5:  [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(tmp_string, "Read(Length=%ld): ", (*real_size));
data/lpc21isp-1.97/lpc21isp.c:1175: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.
        char pTemp[2000];
data/lpc21isp-1.97/lpc21isp.c:1223: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 tmp_string[32];
data/lpc21isp-1.97/lpc21isp.c:1224: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.
    static char residual_data[128] = {'\0'};
data/lpc21isp-1.97/lpc21isp.c:1301:5:  [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(tmp_string, "Answer(Length=%ld): ", (*RealSize));
data/lpc21isp-1.97/lpc21isp.c:1322: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 tmp_string[32];
data/lpc21isp-1.97/lpc21isp.c:1336:5:  [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(tmp_string, "Answer(Length=%ld): ", realsize);
data/lpc21isp-1.97/lpc21isp.c:1403:54:  [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).
                if(isdigit(*num) != 0) debug_level = atoi( num);
data/lpc21isp-1.97/lpc21isp.c:1427:23:  [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).
                retry=atoi(&argv[i][4]);
data/lpc21isp-1.97/lpc21isp.c:1643: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 gpio_isp_filename[256];
data/lpc21isp-1.97/lpc21isp.c:1644: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 gpio_rst_filename[256];
data/lpc21isp-1.97/lpc21isp.c:1649: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(gpio_isp_filename, "/sys/class/gpio/gpio%d/value", GPIO_ISP);
data/lpc21isp-1.97/lpc21isp.c:1652: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(gpio_rst_filename, "/sys/class/gpio/gpio%d/value", GPIO_RST);
data/lpc21isp-1.97/lpc21isp.c:1654:14:  [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).
  gpio_isp = open(gpio_isp_filename, O_WRONLY);
data/lpc21isp-1.97/lpc21isp.c:1661:14:  [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).
  gpio_rst = open(gpio_rst_filename, O_WRONLY);
data/lpc21isp-1.97/lpc21isp.c:2016:21:  [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).
            fdout = open("debugout.bin", O_RDWR | O_BINARY | O_CREAT | O_TRUNC, 0777);
data/lpc21isp-1.97/lpc21isp.c:2043:10:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    fd = open(filename, O_RDONLY | O_BINARY);
data/lpc21isp-1.97/lpc21isp.c:2282:21:  [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).
            fdout = open("debugout.bin", O_RDWR | O_BINARY | O_CREAT | O_TRUNC, 0777);
data/lpc21isp-1.97/lpc21isp.c:2371:18:  [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).
         fdout = open("debugout.bin", O_RDWR | O_BINARY | O_CREAT | O_TRUNC, 0777);
data/lpc21isp-1.97/lpc21isp.h:198: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 StringOscillator[6];           /**< Holds representation of oscillator
data/lpc21isp-1.97/lpcprog.c:568:39:  [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).
            Result = (unsigned char) (atoi(&Answer[i]));
data/lpc21isp-1.97/lpcprog.c:584: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 Answer[128];
data/lpc21isp-1.97/lpcprog.c:585: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 ExpectedAnswer[128];
data/lpc21isp-1.97/lpcprog.c:586: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 temp[128];
data/lpc21isp-1.97/lpcprog.c:594: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 tmpString[128];
data/lpc21isp-1.97/lpcprog.c:595: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 uuencode_table[64];
data/lpc21isp-1.97/lpcprog.c:608: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 tmp_string[64];
data/lpc21isp-1.97/lpcprog.c:622: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.
    local_static char sendbuf0[128];
data/lpc21isp-1.97/lpcprog.c:623: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.
    local_static char sendbuf1[128];
data/lpc21isp-1.97/lpcprog.c:624: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.
    local_static char sendbuf2[128];
data/lpc21isp-1.97/lpcprog.c:625: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.
    local_static char sendbuf3[128];
data/lpc21isp-1.97/lpcprog.c:626: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.
    local_static char sendbuf4[128];
data/lpc21isp-1.97/lpcprog.c:627: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.
    local_static char sendbuf5[128];
data/lpc21isp-1.97/lpcprog.c:628: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.
    local_static char sendbuf6[128];
data/lpc21isp-1.97/lpcprog.c:629: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.
    local_static char sendbuf7[128];
data/lpc21isp-1.97/lpcprog.c:630: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.
    local_static char sendbuf8[128];
data/lpc21isp-1.97/lpcprog.c:631: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.
    local_static char sendbuf9[128];
data/lpc21isp-1.97/lpcprog.c:632: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.
    local_static char sendbuf10[128];
data/lpc21isp-1.97/lpcprog.c:633: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.
    local_static char sendbuf11[128];
data/lpc21isp-1.97/lpcprog.c:634: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.
    local_static char sendbuf12[128];
data/lpc21isp-1.97/lpcprog.c:635: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.
    local_static char sendbuf13[128];
data/lpc21isp-1.97/lpcprog.c:636: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.
    local_static char sendbuf14[128];
data/lpc21isp-1.97/lpcprog.c:637: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.
    local_static char sendbuf15[128];
data/lpc21isp-1.97/lpcprog.c:638: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.
    local_static char sendbuf16[128];
data/lpc21isp-1.97/lpcprog.c:639: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.
    local_static char sendbuf17[128];
data/lpc21isp-1.97/lpcprog.c:640: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.
    local_static char sendbuf18[128];
data/lpc21isp-1.97/lpcprog.c:641: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.
    local_static char sendbuf19[128];
data/lpc21isp-1.97/lpcprog.c:643: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 * sendbuf[20] = {    sendbuf0,  sendbuf1,  sendbuf2,  sendbuf3,  sendbuf4,
data/lpc21isp-1.97/lpcprog.c:698:13:  [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(tmp_string, "StrippedAnswer(Length=%d): ", strippedsize);
data/lpc21isp-1.97/lpcprog.c:1034:13:  [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(tmpString, "P %d %d 0\r\n", 0, LPCtypes[IspEnvironment->DetectedDevice].FlashSectors-1);
data/lpc21isp-1.97/lpcprog.c:1038:13:  [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(tmpString, "P %d %d\r\n", 0, LPCtypes[IspEnvironment->DetectedDevice].FlashSectors-1);
data/lpc21isp-1.97/lpcprog.c:1051:13:  [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(tmpString, "E %d %d 0\r\n", 0, LPCtypes[IspEnvironment->DetectedDevice].FlashSectors-1);
data/lpc21isp-1.97/lpcprog.c:1055:13:  [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(tmpString, "E %d %d\r\n", 0, LPCtypes[IspEnvironment->DetectedDevice].FlashSectors-1);
data/lpc21isp-1.97/lpcprog.c:1078:13:  [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(tmpString, "P %d %d 0\r\n", 0, 0);
data/lpc21isp-1.97/lpcprog.c:1082:13:  [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(tmpString, "P %d %d\r\n", 0, 0);
data/lpc21isp-1.97/lpcprog.c:1095:13:  [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(tmpString, "E %d %d 0\r\n", 0, 0);
data/lpc21isp-1.97/lpcprog.c:1099:13:  [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(tmpString, "E %d %d\r\n", 0, 0);
data/lpc21isp-1.97/lpcprog.c:1127:17:  [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(tmpString, "P %ld %ld 0\r\n", Sector, Sector);
data/lpc21isp-1.97/lpcprog.c:1131:17:  [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(tmpString, "P %ld %ld\r\n", Sector, Sector);
data/lpc21isp-1.97/lpcprog.c:1148:21:  [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(tmpString, "E %ld %ld 0\r\n", Sector, Sector);
data/lpc21isp-1.97/lpcprog.c:1152:21:  [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(tmpString, "E %ld %ld\r\n", Sector, Sector);
data/lpc21isp-1.97/lpcprog.c:1227:13:  [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(tmpString, "W %ld %ld\r\n", ReturnValueLpcRamBase(IspEnvironment), CopyLength);
data/lpc21isp-1.97/lpcprog.c:1347:33:  [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(tmpString, "%ld\r\n", block_CRC);
data/lpc21isp-1.97/lpcprog.c:1353:33:  [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(tmpString, "%ld\nOK\n", block_CRC);
data/lpc21isp-1.97/lpcprog.c:1376:29:  [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(tmpString, "%ld\r\n", block_CRC);
data/lpc21isp-1.97/lpcprog.c:1381:29:  [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(tmpString, "%ld\nOK\n", block_CRC);
data/lpc21isp-1.97/lpcprog.c:1401:25:  [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(tmpString, "%ld\r\n", block_CRC);
data/lpc21isp-1.97/lpcprog.c:1407:25:  [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(tmpString, "%ld\nOK\n", block_CRC);
data/lpc21isp-1.97/lpcprog.c:1429:21:  [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(tmpString, "%ld\r\n", block_CRC);
data/lpc21isp-1.97/lpcprog.c:1434:21:  [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(tmpString, "%ld\nOK\n", block_CRC);
data/lpc21isp-1.97/lpcprog.c:1447:26:  [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 BigAnswer[4096];
data/lpc21isp-1.97/lpcprog.c:1487:21:  [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(tmpString, "P %ld %ld 0\r\n", Sector, Sector);
data/lpc21isp-1.97/lpcprog.c:1491:21:  [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(tmpString, "P %ld %ld\r\n", Sector, Sector);
data/lpc21isp-1.97/lpcprog.c:1524:17:  [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(tmpString, "C %ld %ld %ld\r\n", IspEnvironment->BinaryOffset + SectorStart + SectorOffset, ReturnValueLpcRamBase(IspEnvironment), CopyLength);
data/lpc21isp-1.97/lpcprog.c:1540:25:  [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(tmpString, "M %d %ld %ld\r\n", 64, ReturnValueLpcRamBase(IspEnvironment) + (64 - SectorStart - SectorOffset), CopyLength-(64 - SectorStart - SectorOffset));
data/lpc21isp-1.97/lpcprog.c:1544:25:  [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(tmpString, "M %ld %ld %ld\r\n", SectorStart + SectorOffset, ReturnValueLpcRamBase(IspEnvironment), CopyLength);
data/lpc21isp-1.97/lpcprog.c:1597:13:  [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(tmpString, "G %ld A\r\n", IspEnvironment->StartAddress);
data/lpc21isp-1.97/lpcprog.c:1606:13:  [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(tmpString, "G %ld T\r\n", IspEnvironment->StartAddress & ~1);
data/lpc21isp-1.97/lpcprog.c:1610:13:  [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(tmpString, "G 0 T\r\n");
data/lpc21isp-1.97/lpcprog.c:1634:17:  [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(ExpectedAnswer, "G %ld A\n0", IspEnvironment->StartAddress);
data/lpc21isp-1.97/lpcprog.c:1643:17:  [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(ExpectedAnswer, "G %ld T\n0", IspEnvironment->StartAddress & ~1);
data/lpc21isp-1.97/lpcprog.c:1647:17:  [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(ExpectedAnswer, "G 0 T\n0");
data/lpc21isp-1.97/lpcterm.c:77: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.
        char buffer[128];
data/lpc21isp-1.97/lpcterm.c:84:25:  [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).
            fdlogfile = open("lpc21isp.log", O_RDWR | O_BINARY | O_CREAT | O_TRUNC, 0777);
data/lpc21isp-1.97/adprog.h:35:50:  [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).
#define ANALOG_DEVICES_SYNC_SIZE                (strlen(ANALOG_DEVICES_SYNC_RESPONSE))
data/lpc21isp-1.97/lpc21isp.c:764:41:  [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).
    SendComPortBlock(IspEnvironment, s, strlen(s));
data/lpc21isp-1.97/lpc21isp.c:805: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).
        *real_size = strlen (pRxTmpBuf);
data/lpc21isp-1.97/lpc21isp.c:810:17:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                strncpy((char*) answer, pRxTmpBuf, *real_size);
data/lpc21isp-1.97/lpc21isp.c:816:17:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                strncpy((char*) answer, pRxTmpBuf, max_size);
data/lpc21isp-1.97/lpc21isp.c:829:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    *real_size = read(IspEnvironment->fdCom, answer, max_size);
data/lpc21isp-1.97/lpc21isp.c:846:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            *real_size=read(IspEnvironment->fdCom, answer, max_size);
data/lpc21isp-1.97/lpc21isp.c:936:5:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    read(0,&ch,1);
data/lpc21isp-1.97/lpc21isp.c:1136: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(MilliSeconds*1000); //convert to microseconds
data/lpc21isp-1.97/lpc21isp.c:1245:28:  [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).
            tmp_realsize = strlen((char *)Answer);
data/lpc21isp-1.97/lpc21isp.c:1320:33:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    unsigned long realsize = 0, read;
data/lpc21isp-1.97/lpc21isp.c:1330:82:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        ReceiveComPortBlock(IspEnvironment, result + realsize, size - realsize, &read);
data/lpc21isp-1.97/lpc21isp.c:1332:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        realsize += read;
data/lpc21isp-1.97/lpc21isp.c:1534: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).
        for (i = 0; i < strlen(argv[argc - 1]) && i < (sizeof(IspEnvironment->StringOscillator) - 1) &&
data/lpc21isp-1.97/lpc21isp.c:1599:13:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        if (strlen(IspEnvironment->StringOscillator) > 5)
data/lpc21isp-1.97/lpc21isp.c:2073:5:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    read(fd, FileContent, FileLength);
data/lpc21isp-1.97/lpcprog.c:416: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).
    cmdlen = strlen(Command);
data/lpc21isp-1.97/lpcprog.c:420: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).
    cmdlen = strlen(FormattedCommand);
data/lpc21isp-1.97/lpcprog.c:781: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(Answer, temp, strlen(temp)) != 0)
data/lpc21isp-1.97/lpcprog.c:787: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(Answer + strlen(temp), "0\n", 2) == 0)
data/lpc21isp-1.97/lpcprog.c:789:35:  [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).
        strippedAnswer = Answer + strlen(temp) + 2;
data/lpc21isp-1.97/lpcprog.c:816: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(Answer, temp, strlen(temp)) != 0)
data/lpc21isp-1.97/lpcprog.c:835: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).
        if ((endPtr[0] == '\0') || (endPtr[strlen(endPtr)-1] != '\n'))
data/lpc21isp-1.97/lpcprog.c:970: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(Answer, temp, strlen(temp)) != 0)
data/lpc21isp-1.97/lpcprog.c:976: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(Answer + strlen(cmdstr), "0\n", 2) == 0)
data/lpc21isp-1.97/lpcprog.c:978:35:  [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).
        strippedAnswer = Answer + strlen(temp) + 2;
data/lpc21isp-1.97/lpcprog.c:1314:56:  [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(Answer, tmpString, strlen(tmpString)) != 0)
data/lpc21isp-1.97/lpcprog.c:1656:90:  [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 (realsize == 0 || strncmp((const char *)Answer, /*cmdstr*/ExpectedAnswer, strlen(/*cmdstr*/ExpectedAnswer)) != 0)

ANALYSIS SUMMARY:

Hits = 123
Lines analyzed = 5261 in approximately 0.19 seconds (27032 lines/second)
Physical Source Lines of Code (SLOC) = 3398
Hits@level = [0]   6 [1]  28 [2]  89 [3]   0 [4]   6 [5]   0
Hits@level+ = [0+] 129 [1+] 123 [2+]  95 [3+]   6 [4+]   6 [5+]   0
Hits/KSLOC@level+ = [0+] 37.9635 [1+] 36.1978 [2+] 27.9576 [3+] 1.76574 [4+] 1.76574 [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.