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/vdr-plugin-dvbhddevice-2.2.0/hdffcmd.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/hdffosd.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/hdffosd.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/setup.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/setup.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/menu.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/menu.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_osd.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_hdmi.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/bitbuffer.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_osd.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_mux.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_remote.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_hdmi.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_av.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_defs.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_base.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_generic.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_remote.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_base.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/bitbuffer.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_generic.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_av.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_mux.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/dvbhddevice.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/hdffcmd.h
Examining data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c
Examining data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.h

FINAL RESULTS:

data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:1004:23:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
  FileName = cString::sprintf("/sys/class/dvb/dvb%d.frontend%d/device/subsystem_vendor", Adapter, Frontend);
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:1010:23:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
  FileName = cString::sprintf("/sys/class/dvb/dvb%d.frontend%d/device/subsystem_device", Adapter, Frontend);
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:1018:30:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
         FileName = cString::sprintf("/dev/dvb/adapter%d/osd0", Adapter);
data/vdr-plugin-dvbhddevice-2.2.0/menu.c:62:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(str, "%s: %s", tr("Video Conversion"), gHdffSetup.GetVideoConversionString());
data/vdr-plugin-dvbhddevice-2.2.0/dvbhddevice.c:61:15:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ((c = getopt_long(argc, argv, "o", long_options, NULL)) != -1) {
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:95:6:  [2] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused). Risk is low because the source is a constant string.
     strcpy(hdmiConfig.CecDeviceName, "VDR");
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:196: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 buf[32];
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:204:25:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
                        memcpy(result, buf, l);
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:744:18:  [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[blen], &Data[offs], len);
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:786: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(TsBuffer + 4, Data, 184);
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:800: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(TsBuffer + 5 + adaptationLength, Data, Length);
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:1005: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).
  if ((f = fopen(FileName, "r")) != NULL) {
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:1011: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).
  if ((f = fopen(FileName, "r")) != NULL) {
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:1019:19:  [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).
         int fd = open(FileName, O_RDWR);
data/vdr-plugin-dvbhddevice-2.2.0/hdffosd.c:283:25:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
            FILE * fp = fopen(fontFileName, "rb");
data/vdr-plugin-dvbhddevice-2.2.0/hdffosd.c:799:25:  [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 + r * width, bitmap->Data(x1, y1 + y + r), width);
data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_generic.c:67:17:  [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(String, &resultData[10], textLength);
data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_generic.c:112:17:  [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(String, &resultData[10], textLength);
data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_generic.c:159:17:  [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(String, resultData + 8, textLen);
data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_hdmi.h:50: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 CecDeviceName[14];
data/vdr-plugin-dvbhddevice-2.2.0/menu.c:61: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 str[128];
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:42:74:  [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      (strcmp(Name, "Resolution")        == 0) Resolution        = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:43:74:  [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).
    else if (strcmp(Name, "VideoModeAdaption") == 0) VideoModeAdaption = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:44:74:  [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).
    else if (strcmp(Name, "TvFormat")          == 0) TvFormat          = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:45:74:  [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).
    else if (strcmp(Name, "VideoConversion")   == 0) VideoConversion   = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:46:74:  [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).
    else if (strcmp(Name, "AnalogueVideo")     == 0) AnalogueVideo     = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:47:74:  [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).
    else if (strcmp(Name, "AudioDelay")        == 0) AudioDelay        = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:48:74:  [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).
    else if (strcmp(Name, "AudioDownmix")      == 0) AudioDownmix      = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:49:74:  [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).
    else if (strcmp(Name, "AvSyncShift")       == 0) AvSyncShift       = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:50:74:  [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).
    else if (strcmp(Name, "OsdSize")           == 0) OsdSize           = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:51:74:  [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).
    else if (strcmp(Name, "CecEnabled")        == 0) CecEnabled        = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:52:74:  [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).
    else if (strcmp(Name, "CecTvOn")           == 0) CecTvOn           = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:53:74:  [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).
    else if (strcmp(Name, "CecTvOff")          == 0) CecTvOff          = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:54:74:  [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).
    else if (strcmp(Name, "RemoteProtocol")    == 0) RemoteProtocol    = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:55:74:  [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).
    else if (strcmp(Name, "RemoteAddress")     == 0) RemoteAddress     = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:56:74:  [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).
    else if (strcmp(Name, "HighLevelOsd")      == 0) HighLevelOsd      = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:57:74:  [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).
    else if (strcmp(Name, "TrueColorOsd")      == 0) TrueColorOsd      = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:58:74:  [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).
    else if (strcmp(Name, "TrueColorFormat")   == 0) TrueColorFormat   = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:59:74:  [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).
    else if (strcmp(Name, "HideMainMenu")      == 0) HideMainMenu      = atoi(Value);
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:207: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.
    static const char * ResolutionItems[kResolutions] =
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:215: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.
    static const char * VideoModeAdaptionItems[kVideoModeAdaptions] =
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:223: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.
    static const char * TvFormatItems[kTvFormats] =
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:229: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.
    static const char * AnalogueVideoItems[kAnalogueVideos] =
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:237: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.
    static const char * AudioDownmixItems[kAudioDownmixes] =
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:246: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.
    static const char * OsdSizeItems[kOsdSizes] =
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:262: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.
    static const char * TrueColorFormatItems[kTrueColorFormats] =
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:337: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.
    static const char * VideoConversionItems4by3[kVideoConversions4by3] =
data/vdr-plugin-dvbhddevice-2.2.0/setup.c:344: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.
    static const char * VideoConversionItems16by9[kVideoConversions16by9] =
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:155:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        readBytes = read(fd, buffer, BUFFER_SIZE);
data/vdr-plugin-dvbhddevice-2.2.0/dvbhdffdevice.c:199:29:  [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 l = strlen(buf);
data/vdr-plugin-dvbhddevice-2.2.0/hdffcmd.c:61: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).
        return strlen(pString);
data/vdr-plugin-dvbhddevice-2.2.0/libhdffcmd/hdffcmd_hdmi.c:67: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).
    nameLen = strlen(Config->CecDeviceName);

ANALYSIS SUMMARY:

Hits = 52
Lines analyzed = 5985 in approximately 0.13 seconds (44430 lines/second)
Physical Source Lines of Code (SLOC) = 4735
Hits@level = [0]   3 [1]   4 [2]  43 [3]   1 [4]   4 [5]   0
Hits@level+ = [0+]  55 [1+]  52 [2+]  48 [3+]   5 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 11.6156 [1+] 10.982 [2+] 10.1373 [3+] 1.05597 [4+] 0.844773 [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.