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/libmtp-1.1.18/util/mtp-probe.c
Examining data/libmtp-1.1.18/util/mtp-hotplug.c
Examining data/libmtp-1.1.18/examples/thumb.c
Examining data/libmtp-1.1.18/examples/util.c
Examining data/libmtp-1.1.18/examples/util.h
Examining data/libmtp-1.1.18/examples/common.h
Examining data/libmtp-1.1.18/examples/newfolder.c
Examining data/libmtp-1.1.18/examples/detect.c
Examining data/libmtp-1.1.18/examples/newplaylist.c
Examining data/libmtp-1.1.18/examples/albumart.c
Examining data/libmtp-1.1.18/examples/connect.h
Examining data/libmtp-1.1.18/examples/tracks.c
Examining data/libmtp-1.1.18/examples/filetree.c
Examining data/libmtp-1.1.18/examples/getfile.c
Examining data/libmtp-1.1.18/examples/getplaylist.c
Examining data/libmtp-1.1.18/examples/pathutils.c
Examining data/libmtp-1.1.18/examples/sendfile.c
Examining data/libmtp-1.1.18/examples/albums.c
Examining data/libmtp-1.1.18/examples/reset.c
Examining data/libmtp-1.1.18/examples/delfile.c
Examining data/libmtp-1.1.18/examples/playlists.c
Examining data/libmtp-1.1.18/examples/sendtr.c
Examining data/libmtp-1.1.18/examples/connect.c
Examining data/libmtp-1.1.18/examples/pathutils.h
Examining data/libmtp-1.1.18/examples/files.c
Examining data/libmtp-1.1.18/examples/folders.c
Examining data/libmtp-1.1.18/examples/emptyfolders.c
Examining data/libmtp-1.1.18/examples/trexist.c
Examining data/libmtp-1.1.18/examples/format.c
Examining data/libmtp-1.1.18/doc/examples.h
Examining data/libmtp-1.1.18/doc/mainpage.h
Examining data/libmtp-1.1.18/src/playlist-spl.h
Examining data/libmtp-1.1.18/src/util.c
Examining data/libmtp-1.1.18/src/libmtp.c
Examining data/libmtp-1.1.18/src/util.h
Examining data/libmtp-1.1.18/src/device-flags.h
Examining data/libmtp-1.1.18/src/music-players.h
Examining data/libmtp-1.1.18/src/_stdint.h
Examining data/libmtp-1.1.18/src/libmtp.h
Examining data/libmtp-1.1.18/src/ptp.h
Examining data/libmtp-1.1.18/src/ptp.c
Examining data/libmtp-1.1.18/src/chdk_live_view.h
Examining data/libmtp-1.1.18/src/chdk_ptp.h
Examining data/libmtp-1.1.18/src/unicode.c
Examining data/libmtp-1.1.18/src/playlist-spl.c
Examining data/libmtp-1.1.18/src/libusb-glue.c
Examining data/libmtp-1.1.18/src/libusb-glue.h
Examining data/libmtp-1.1.18/src/libusb1-glue.c
Examining data/libmtp-1.1.18/src/ptp-pack.c
Examining data/libmtp-1.1.18/src/mtpz.c
Examining data/libmtp-1.1.18/src/libopenusb1-glue.c
Examining data/libmtp-1.1.18/src/gphoto2-endian.h
Examining data/libmtp-1.1.18/src/mtpz.h
Examining data/libmtp-1.1.18/src/unicode.h

FINAL RESULTS:

data/libmtp-1.1.18/examples/pathutils.c:45:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(current,"%s/%s",parent,folder->name);
data/libmtp-1.1.18/examples/sendtr.c:208:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy (to_path_copy,to_path);
data/libmtp-1.1.18/src/libmtp.c:1730:27:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
__attribute__((__format__(printf,2,0)))
data/libmtp-1.1.18/src/libmtp.c:1735:5:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vfprintf (stderr, format, args);
data/libmtp-1.1.18/src/libmtp.c:1747:27:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
__attribute__((__format__(printf,2,0)))
data/libmtp-1.1.18/src/libmtp.c:1752:5:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vfprintf (stderr, format, args);
data/libmtp-1.1.18/src/libmtp.c:5599:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(newname, "%s_%d%s", basename, suffix, extension_position);
data/libmtp-1.1.18/src/libmtp.c:5602:7:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
      sprintf(newname, "%s_%d%s", basename, suffix, extension_position);
data/libmtp-1.1.18/src/libmtp.c:7803:5:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
    strcat(fname, suffix);
data/libmtp-1.1.18/src/libmtp.h:40:9:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#define snprintf _snprintf
data/libmtp-1.1.18/src/libmtp.h:40:18:  [4] (format) _snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
#define snprintf _snprintf
data/libmtp-1.1.18/src/libopenusb1-glue.c:734:9:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        vfprintf(stderr, format, args);
data/libmtp-1.1.18/src/libopenusb1-glue.c:749:9:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        vfprintf(stderr, format, args);
data/libmtp-1.1.18/src/libusb-glue.c:766:17:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                vfprintf (stderr, format, args);
data/libmtp-1.1.18/src/libusb-glue.c:783:17:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                vfprintf (stderr, format, args);
data/libmtp-1.1.18/src/libusb-glue.h:57:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
      fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \
data/libmtp-1.1.18/src/libusb1-glue.c:785:17:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                vfprintf (stderr, format, args);
data/libmtp-1.1.18/src/libusb1-glue.c:802:17:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                vfprintf (stderr, format, args);
data/libmtp-1.1.18/src/mtpz.c:129:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf(path, "%s/.mtpz-data", home);
data/libmtp-1.1.18/src/playlist-spl.c:52:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
      fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \
data/libmtp-1.1.18/src/playlist-spl.c:226:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy(f->filename, pl->name);
data/libmtp-1.1.18/src/playlist-spl.c:307:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(s, newlist->name);
data/libmtp-1.1.18/src/playlist-spl.c:686:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy(iw,files->filename);
data/libmtp-1.1.18/src/playlist-spl.c:697:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(iw, f);
data/libmtp-1.1.18/src/ptp.c:99:17:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                vfprintf (stderr, format, args);
data/libmtp-1.1.18/src/ptp.c:116:17:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                vfprintf (stderr, format, args);
data/libmtp-1.1.18/src/ptp.c:3302:4:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
			strcpy((char*)data + 8, value->str);
data/libmtp-1.1.18/src/ptp.c:6484:11:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
			return snprintf(out, length, 
data/libmtp-1.1.18/src/ptp.h:2726:28:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	__attribute__((__format__(printf,2,0)))
data/libmtp-1.1.18/src/ptp.h:2731:28:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	__attribute__((__format__(printf,2,0)))
data/libmtp-1.1.18/src/util.h:40:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
      fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \
data/libmtp-1.1.18/src/util.h:42:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
      fprintf(stdout, format, ##args); \
data/libmtp-1.1.18/src/util.h:51:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
      fprintf(stderr, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \
data/libmtp-1.1.18/src/util.h:53:7:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
      fprintf(stderr, format, ##args); \
data/libmtp-1.1.18/util/mtp-probe.c:76:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy(pbuf, path);
data/libmtp-1.1.18/util/mtp-probe.c:141:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy(pbuf, path);
data/libmtp-1.1.18/util/mtp-probe.c:183:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy(dirbuf, sysfspath);
data/libmtp-1.1.18/util/mtp-probe.c:247:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
  strcpy(dirbuf, sysfspath);
data/libmtp-1.1.18/examples/albumart.c:62:18:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ( (opt = getopt(argc, argv, "dhn:i:s:p:")) != -1 ) {
data/libmtp-1.1.18/examples/albums.c:80:17:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ((opt = getopt(argc, argv, "d")) != -1 ) {
data/libmtp-1.1.18/examples/connect.c:113: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.
      int c = getopt_long (argc, argv, "d:f:g:n:t:", long_options, &option_index);
data/libmtp-1.1.18/examples/detect.c:71:17:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ((opt = getopt(argc, argv, "d")) != -1 ) {
data/libmtp-1.1.18/examples/emptyfolders.c:67:18:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ( (opt = getopt(argc, argv, "d")) != -1 ) {
data/libmtp-1.1.18/examples/filetree.c:83:17:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ((opt = getopt(argc, argv, "d")) != -1 ) {
data/libmtp-1.1.18/examples/newplaylist.c:50:18:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ( (opt = getopt(argc, argv, "hn:i:s:p:")) != -1 ) {
data/libmtp-1.1.18/examples/sendtr.c:406:18:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ( (opt = getopt(argc, argv, "qD:t:a:A:w:l:c:g:n:d:y:s:")) != -1 ) {
data/libmtp-1.1.18/examples/thumb.c:58:18:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ( (opt = getopt(argc, argv, "hi:")) != -1 ) {
data/libmtp-1.1.18/examples/util.c:39:22:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
  const char *lang = getenv("LANG");
data/libmtp-1.1.18/src/libmtp.c:776:27:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
  const char *env_debug = getenv("LIBMTP_DEBUG");
data/libmtp-1.1.18/src/mtpz.c:119:15:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
	char *home = getenv("HOME");
data/libmtp-1.1.18/src/mtpz.c:1508:71:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
ptp_mtpz_validatehandshakeresponse (PTPParams* params, unsigned char *random, unsigned char **calculatedHash)
data/libmtp-1.1.18/src/mtpz.c:1611:24:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	if (memcmp(rand_data, random, 16) != 0)
data/libmtp-1.1.18/src/mtpz.c:1696:2:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	srand(time(NULL));
data/libmtp-1.1.18/src/mtpz.c:1701:16:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	*out_random = random;
data/libmtp-1.1.18/src/mtpz.c:1702:17:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	memcpy(target, random, 16);
data/libmtp-1.1.18/src/mtpz.c:1815:85:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	applicationCertificateMessage = ptp_mtpz_makeapplicationcertificatemessage(&size, &random);
data/libmtp-1.1.18/src/mtpz.c:1822:51:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	ret = ptp_mtpz_validatehandshakeresponse(params, random, &hash);
data/libmtp-1.1.18/src/mtpz.c:1838:7:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	free(random);
data/libmtp-1.1.18/util/mtp-hotplug.c:80:18:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while ( (opt = getopt(argc, argv, "wuoiHa:p:g:m:")) != -1 ) {
data/libmtp-1.1.18/examples/albumart.c:120: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).
  if ( (fd = open(path, O_RDONLY|O_BINARY) == -1) ) {
data/libmtp-1.1.18/examples/albumart.c:122: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).
  if ( (fd = open(path, O_RDONLY)) == -1) {
data/libmtp-1.1.18/examples/detect.c:245:23:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
	      FILE *xmltmp = tmpfile();
data/libmtp-1.1.18/examples/format.c:29:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char buff[2];
data/libmtp-1.1.18/examples/newfolder.c:45:49:  [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).
  newid = LIBMTP_Create_Folder(device, argv[1], atol(argv[2]), atol(argv[3]));
data/libmtp-1.1.18/examples/newfolder.c:45:64:  [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).
  newid = LIBMTP_Create_Folder(device, argv[1], atol(argv[2]), atol(argv[3]));
data/libmtp-1.1.18/examples/reset.c:29:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char buff[2];
data/libmtp-1.1.18/examples/sendtr.c:145:7:  [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(tracks, found_album->tracks, found_album->no_tracks * sizeof(uint32_t));
data/libmtp-1.1.18/examples/sendtr.c:188: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 artist[80], albumartist[80], title[80], genre[80], album[80], composer[80];
data/libmtp-1.1.18/examples/sendtr.c:190: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 num[80];
data/libmtp-1.1.18/examples/sendtr.c:323: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[80];
data/libmtp-1.1.18/examples/sendtr.c:437:18:  [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).
      tracknum = atoi(optarg);
data/libmtp-1.1.18/examples/sendtr.c:443:16:  [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).
      length = atoi(optarg);
data/libmtp-1.1.18/examples/sendtr.c:446:14:  [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).
      year = atoi(optarg);
data/libmtp-1.1.18/examples/thumb.c:88: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).
  if ( (fd = open(path, O_RDONLY|O_BINARY) == -1) ) {
data/libmtp-1.1.18/examples/thumb.c:90: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).
  if ( (fd = open(path, O_RDONLY)) == -1) {
data/libmtp-1.1.18/src/libmtp.c:945: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 tmp[64];
data/libmtp-1.1.18/src/libmtp.c:2517: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 outstr[256];
data/libmtp-1.1.18/src/libmtp.c:2732:7:  [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(&params->objects[i].mtpprops[params->objects[i].nrofmtpprops],
data/libmtp-1.1.18/src/libmtp.c:2775: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 buf[80];
data/libmtp-1.1.18/src/libmtp.c:2776: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(buf,"get_handles_recursively(): could not get object handles of %08x", parent);
data/libmtp-1.1.18/src/libmtp.c:3228:7:  [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 txt[256];
data/libmtp-1.1.18/src/libmtp.c:3414: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 fourcc[6];
data/libmtp-1.1.18/src/libmtp.c:4553: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 buf[80];
data/libmtp-1.1.18/src/libmtp.c:4554: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(buf,"LIBMTP_Get_Files_And_Folders(): could not get object handles of %08x.", parent);
data/libmtp-1.1.18/src/libmtp.c:5230: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).
  if ( (fd = open(path, O_RDWR|O_CREAT|O_TRUNC|O_BINARY,S_IRWXU)) == -1 ) {
data/libmtp-1.1.18/src/libmtp.c:5233: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).
  if ( (fd = open(path, O_RDWR|O_CREAT|O_TRUNC,S_IRWXU|S_IRGRP)) == -1) {
data/libmtp-1.1.18/src/libmtp.c:5535: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).
  if ( (fd = open(path, O_RDONLY|O_BINARY)) == -1 ) {
data/libmtp-1.1.18/src/libmtp.c:5538: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).
  if ( (fd = open(path, O_RDONLY)) == -1) {
data/libmtp-1.1.18/src/libmtp.c:5593: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 basename[extension_position - filename + 1];
data/libmtp-1.1.18/src/libmtp.c:5598: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 newname[ strlen(basename) + 6 + strlen(extension_position)];
data/libmtp-1.1.18/src/libmtp.c:5870: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).
  if ( (fd = open(path, O_RDONLY|O_BINARY)) == -1 ) {
data/libmtp-1.1.18/src/libmtp.c:5873: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).
  if ( (fd = open(path, O_RDONLY)) == -1) {
data/libmtp-1.1.18/src/libmtp.c:7762: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 fname[256];
data/libmtp-1.1.18/src/libopenusb1-glue.c:211:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char buf[1024], cmd;
data/libmtp-1.1.18/src/libopenusb1-glue.c:1080: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(data, priv->data + priv->curoff, tocopy);
data/libmtp-1.1.18/src/libopenusb1-glue.c:1096: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(priv->data + priv->curoff, data, sendlen);
data/libmtp-1.1.18/src/libopenusb1-glue.c:1289: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(packet, params->response_packet, params->response_packet_size);
data/libmtp-1.1.18/src/libopenusb1-glue.c:1301: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(packet, x, *rlen);
data/libmtp-1.1.18/src/libopenusb1-glue.c:1401: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(params->response_packet,
data/libmtp-1.1.18/src/libopenusb1-glue.c:1712:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char buffer[6];
data/libmtp-1.1.18/src/libopenusb1-glue.c:1743:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char buf[255];
data/libmtp-1.1.18/src/libopenusb1-glue.c:2108: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(&ptp_usb->rawdevice, device, sizeof (LIBMTP_raw_device_t));
data/libmtp-1.1.18/src/libusb-glue.c:240:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  unsigned char buf[1024], cmd;
data/libmtp-1.1.18/src/libusb-glue.c:353:6:  [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 devname[0x10];
data/libmtp-1.1.18/src/libusb-glue.c:705: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 devname[0x10];
data/libmtp-1.1.18/src/libusb-glue.c:1072:2:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
	memcpy (data, priv->data + priv->curoff, tocopy);
data/libmtp-1.1.18/src/libusb-glue.c:1088: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 (priv->data + priv->curoff, data, sendlen);
data/libmtp-1.1.18/src/libusb-glue.c:1279:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy(packet, params->response_packet, params->response_packet_size);
data/libmtp-1.1.18/src/libusb-glue.c:1291:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy (packet, x, *rlen);
data/libmtp-1.1.18/src/libusb-glue.c:1389: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(params->response_packet,
data/libmtp-1.1.18/src/libusb-glue.c:1638:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char buffer[6];
data/libmtp-1.1.18/src/libusb-glue.c:1656:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char buf[255];
data/libmtp-1.1.18/src/libusb-glue.c:1998:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(&ptp_usb->rawdevice, device, sizeof(LIBMTP_raw_device_t));
data/libmtp-1.1.18/src/libusb1-glue.c:240:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  unsigned char buf[1024], cmd;
data/libmtp-1.1.18/src/libusb1-glue.c:1176:2:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
	memcpy (data, priv->data + priv->curoff, tocopy);
data/libmtp-1.1.18/src/libusb1-glue.c:1192: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 (priv->data + priv->curoff, data, sendlen);
data/libmtp-1.1.18/src/libusb1-glue.c:1383:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy(packet, params->response_packet, params->response_packet_size);
data/libmtp-1.1.18/src/libusb1-glue.c:1395:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy (packet, x, *rlen);
data/libmtp-1.1.18/src/libusb1-glue.c:1493: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(params->response_packet,
data/libmtp-1.1.18/src/libusb1-glue.c:1845:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char buffer[6];
data/libmtp-1.1.18/src/libusb1-glue.c:1867:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char buffer[4];
data/libmtp-1.1.18/src/libusb1-glue.c:1891:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  unsigned char buf[255];
data/libmtp-1.1.18/src/libusb1-glue.c:2250:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(&ptp_usb->rawdevice, device, sizeof(LIBMTP_raw_device_t));
data/libmtp-1.1.18/src/mtpz.c:128: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 path[plen];
data/libmtp-1.1.18/src/mtpz.c:131:16:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
	FILE *fdata = fopen(path, "r");
data/libmtp-1.1.18/src/mtpz.c:464: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(v5, msg, len);
data/libmtp-1.1.18/src/mtpz.c:604:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy(out, data + offset, chunk);
data/libmtp-1.1.18/src/mtpz.c:659: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(back + i, inner, inner_len);
data/libmtp-1.1.18/src/mtpz.c:661: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(back + i, inner, inner_len);
data/libmtp-1.1.18/src/mtpz.c:713: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(key, constant, key_len);
data/libmtp-1.1.18/src/mtpz.c:1542: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(message, reader, 128);
data/libmtp-1.1.18/src/mtpz.c:1583: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(hash_key, msg_dec + 112, 16);
data/libmtp-1.1.18/src/mtpz.c:1597: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(act_msg, reader, 832);
data/libmtp-1.1.18/src/mtpz.c:1610: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(rand_data, act_reader, rand_length);
data/libmtp-1.1.18/src/mtpz.c:1637: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(machash_data, act_reader, machash_length);
data/libmtp-1.1.18/src/mtpz.c:1656:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char	mch[16];
data/libmtp-1.1.18/src/mtpz.c:1691: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(target, MTPZ_CERTIFICATES, certsLength);
data/libmtp-1.1.18/src/mtpz.c:1702: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(target, random, 16);
data/libmtp-1.1.18/src/mtpz.c:1760: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(target, signature, 128);
data/libmtp-1.1.18/src/playlist-spl.c:102:11:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
#  define mkstemp(_pattern) _open(_mktemp(_pattern), _O_CREAT | _O_SHORT_LIVED | _O_EXCL)
data/libmtp-1.1.18/src/playlist-spl.c:104:18:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
#  error Missing mkstemp() function.
data/libmtp-1.1.18/src/playlist-spl.c:124:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(pl->name, oi->Filename, strlen(oi->Filename) -4);
data/libmtp-1.1.18/src/playlist-spl.c:137:12:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
  int fd = mkstemp(tmpname);
data/libmtp-1.1.18/src/playlist-spl.c:196:12:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
  int fd = mkstemp(tmpname);
data/libmtp-1.1.18/src/playlist-spl.c:227:3:  [2] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused). Risk is low because the
  source is a constant string.
  strcat(f->filename, ".spl"); // append suffix
data/libmtp-1.1.18/src/playlist-spl.c:308:5:  [2] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused). Risk is low because the
  source is a constant string.
    strcat(s,".spl"); // FIXME check for success
data/libmtp-1.1.18/src/playlist-spl.c:331: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 t[MAXREAD];
data/libmtp-1.1.18/src/playlist-spl.c:335: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 w[WSIZE];
data/libmtp-1.1.18/src/playlist-spl.c:603: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 vs[14]; // "VERSION 2.00\0"
data/libmtp-1.1.18/src/playlist-spl.c:604: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(vs,"VERSION %d.%02d",ver_major,ver_minor);
data/libmtp-1.1.18/src/playlist-spl.c:668: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 w[M];
data/libmtp-1.1.18/src/ptp-pack.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 loclstr[PTP_MAXSTRLEN*3+1];
data/libmtp-1.1.18/src/ptp-pack.c:164: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(string, &data[offset+1], length * sizeof(string[0]));
data/libmtp-1.1.18/src/ptp-pack.c:248:2:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
	memcpy(&data[offset+1], &ucs2str[0], packedlen * sizeof(ucs2str[0]));
data/libmtp-1.1.18/src/ptp-pack.c:275: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(retcopy, packed, plen);
data/libmtp-1.1.18/src/ptp-pack.c:706: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 ptpdate[40];
data/libmtp-1.1.18/src/ptp-pack.c:707: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 tmp[5];
data/libmtp-1.1.18/src/ptp-pack.c:728:13:  [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).
	tm.tm_year=atoi (tmp) - 1900;
data/libmtp-1.1.18/src/ptp-pack.c:731:14:  [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).
	tm.tm_mon = atoi (tmp) - 1;
data/libmtp-1.1.18/src/ptp-pack.c:734:15:  [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).
	tm.tm_mday = atoi (tmp);
data/libmtp-1.1.18/src/ptp-pack.c:737:15:  [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).
	tm.tm_hour = atoi (tmp);
data/libmtp-1.1.18/src/ptp-pack.c:740:14:  [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).
	tm.tm_min = atoi (tmp);
data/libmtp-1.1.18/src/ptp-pack.c:743:14:  [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).
	tm.tm_sec = atoi (tmp);
data/libmtp-1.1.18/src/ptp-pack.c:1356:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char *packedprops[MAX_MTP_PROPS];
data/libmtp-1.1.18/src/ptp-pack.c:1401:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy(&opldata[bufp], packedprops[i], packedpropslens[i]);
data/libmtp-1.1.18/src/ptp-pack.c:1823:7:  [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.
	p += sprintf(p,"eosversion=%u,size=%ux%u,size2=%ux%u,points={", version, sizeX, sizeY, size2X, size2Y);
data/libmtp-1.1.18/src/ptp-pack.c:1830:8:  [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.
		p += sprintf(p,"{%d,%d,%d,%d}",x,y,w,h);
data/libmtp-1.1.18/src/ptp-pack.c:1835:7:  [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.
	p += sprintf(p,"},select={");
data/libmtp-1.1.18/src/ptp-pack.c:1838:7:  [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.
			p+=sprintf(p,"%u,", i);
data/libmtp-1.1.18/src/ptp-pack.c:1841:7:  [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.
	p += sprintf(p,"},unknown={");
data/libmtp-1.1.18/src/ptp-pack.c:1845:6:  [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.
		p+=sprintf(p,"%02x", (*data)[i]);
data/libmtp-1.1.18/src/ptp-pack.c:1869:8:  [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.
		p += sprintf(p, "%x,", dtoh32a( *data + 4*i ));
data/libmtp-1.1.18/src/ptp-pack.c:2191:7:  [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 (params->canon_props[j].data,xdata,size-PTP_ece_Prop_Val_Data);
data/libmtp-1.1.18/src/ptp-pack.c:2201: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(params->canon_props[j].data, xdata, size-PTP_ece_Prop_Val_Data);
data/libmtp-1.1.18/src/ptp-pack.c:2504: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(ce[i].u.info, "Button %d",  dtoh16a(curdata+curoff));
data/libmtp-1.1.18/src/ptp-pack.c:2572: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(ce[i].u.info,"OLCInfo event 0x0010 content %02x%02x%02x%02x",
data/libmtp-1.1.18/src/ptp-pack.c:2588: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(ce[i].u.info,"OLCInfo event 0x0020 content %02x%02x%02x%02x%02x%02x",
data/libmtp-1.1.18/src/ptp-pack.c:2605: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(ce[i].u.info,"OLCInfo exposure indicator %d,%d,%d.%d (%02x%02x%02x%02x)",
data/libmtp-1.1.18/src/ptp-pack.c:2621: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(ce[i].u.info,"OLCInfo event 0x0080 content %02x%02x%02x%02x",
data/libmtp-1.1.18/src/ptp-pack.c:2634: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(ce[i].u.info,"%02x%02x%02x%02x%02x%02x",
data/libmtp-1.1.18/src/ptp-pack.c:2649: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(ce[i].u.info,"%02x%02x%02x%02x%02x%02x%02x",
data/libmtp-1.1.18/src/ptp-pack.c:2665: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(ce[i].u.info,"OLCInfo event 0x0400 content %02x%02x%02x%02x%02x%02x%02x",
data/libmtp-1.1.18/src/ptp-pack.c:2682: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(ce[i].u.info,"OLCInfo event 0x0800 content %02x%02x%02x%02x%02x%02x%02x%02x",
data/libmtp-1.1.18/src/ptp-pack.c:2699: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(ce[i].u.info,"OLCInfo event 0x1000 content %02x",
data/libmtp-1.1.18/src/ptp-pack.c:2708:4:  [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(ce[i].u.info, "OLCInfo event mask=%x",  mask);
data/libmtp-1.1.18/src/ptp-pack.c:2725:4:  [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 (ce[i].u.info, "BulbExposureTime %u",  dtoh32a(curdata+8));
data/libmtp-1.1.18/src/ptp-pack.c:2736: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 (ce[i].u.info, "unhandled EOS event "#x" (size %u)",  size);		\
data/libmtp-1.1.18/src/ptp.c:252:2:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
	memcpy (data, priv->data + priv->curoff, tocopy);
data/libmtp-1.1.18/src/ptp.c:270: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 (priv->data + priv->curoff, data, sendlen);
data/libmtp-1.1.18/src/ptp.c:985:2:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
	memcpy(&data[8], value, valuesize);	/* perhaps check if one of the DPV packagers work? */
data/libmtp-1.1.18/src/ptp.c:1019:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char  	data[10];
data/libmtp-1.1.18/src/ptp.c:1036:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char	data[10];
data/libmtp-1.1.18/src/ptp.c:2476: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 (&params->events[params->nrofevents],evt,1*sizeof(PTPContainer));
data/libmtp-1.1.18/src/ptp.c:2885:4:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
			memcpy (&params->events[params->nrofevents],xevent,evtcnt*sizeof(PTPContainer));
data/libmtp-1.1.18/src/ptp.c:2965: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 (event, params->events, sizeof(PTPContainer));
data/libmtp-1.1.18/src/ptp.c:3020:4:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
			memcpy (nentries+params->nrofbacklogentries, entries, nrofentries*sizeof(entries[0]));
data/libmtp-1.1.18/src/ptp.c:3036: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 (entry, params->backlogentries, sizeof(*entry));
data/libmtp-1.1.18/src/ptp.c:3060: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 (dpd, &params->canon_props[i].dpd, sizeof (*dpd));
data/libmtp-1.1.18/src/ptp.c:3064:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy (dpd->FORM.Enum.SupportedValue,
data/libmtp-1.1.18/src/ptp.c:3616: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 (*props, props1, psize1*sizeof(uint16_t));
data/libmtp-1.1.18/src/ptp.c:3617: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 ((*props)+psize1, props2, psize2*sizeof(uint16_t));
data/libmtp-1.1.18/src/ptp.c:3779:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char 	buf[18];
data/libmtp-1.1.18/src/ptp.c:4176:2:  [2] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused). Risk is low because the source is a constant string.
	strcpy(test.profile_name, "MyTest");
data/libmtp-1.1.18/src/ptp.c:4178:2:  [2] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused). Risk is low because the source is a constant string.
	strcpy(test.essid, "nikon");
data/libmtp-1.1.18/src/ptp.c:4211:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char buffer[1024];
data/libmtp-1.1.18/src/ptp.c:4217:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char guid[16];
data/libmtp-1.1.18/src/ptp.c:4253: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(&buffer[0x3A],&profile->ip_address,sizeof(profile->ip_address));
data/libmtp-1.1.18/src/ptp.c:4256: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(&buffer[0x3F],&profile->gateway_address,sizeof(profile->gateway_address));
data/libmtp-1.1.18/src/ptp.c:4275: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(&buffer[0xB2], guid, 16);
data/libmtp-1.1.18/src/ptp.c:4588:7:  [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).
  f = fopen(local_fn,"rb");
data/libmtp-1.1.18/src/ptp.c:4602:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(buf,&file_name_len,4);
data/libmtp-1.1.18/src/ptp.c:4603:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(buf+4,remote_fn,file_name_len);
data/libmtp-1.1.18/src/ptp.c:4748: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((*msg)->data,data,(*msg)->size);
data/libmtp-1.1.18/src/ptp.c:5827:10:  [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).
		return atol(data->str);
data/libmtp-1.1.18/src/ptp.h:104:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
		unsigned char data[PTP_USB_BULK_PAYLOAD_LEN_READ];
data/libmtp-1.1.18/src/ptp.h:1403: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[PTP_CANON_FilenameBufferLen];
data/libmtp-1.1.18/src/ptp.h:1428: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 			static_preamble[6];
data/libmtp-1.1.18/src/ptp.h:1443: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	*line[5];
data/libmtp-1.1.18/src/ptp.h:1451: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      profile_name[17];
data/libmtp-1.1.18/src/ptp.h:1454: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      essid[33];
data/libmtp-1.1.18/src/ptp.h:1461: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      creation_date[16];
data/libmtp-1.1.18/src/ptp.h:1462: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      lastusage_date[16];
data/libmtp-1.1.18/src/unicode.c:81: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 loclstr[STRING_BUFFER_LENGTH*3+1]; // UTF-8 encoding is max 3 bytes per UCS2 char.
data/libmtp-1.1.18/src/unicode.c:116: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 unicstr[(STRING_BUFFER_LENGTH+1)*2]; // UCS2 encoding is 2 bytes per UTF-8 char.
data/libmtp-1.1.18/src/unicode.c:143:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(ret,unicstr,(size_t)ret_len);
data/libmtp-1.1.18/util/mtp-hotplug.c:76: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 mtp_probe_dir[256] = "/usr/lib/udev/";
data/libmtp-1.1.18/util/mtp-probe.c:65: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 pbuf[FILENAME_MAX];
data/libmtp-1.1.18/util/mtp-probe.c:68:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char buf[128];
data/libmtp-1.1.18/util/mtp-probe.c:83:8:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  fd = open(pbuf, O_RDONLY);
data/libmtp-1.1.18/util/mtp-probe.c:104:8:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  fd = open(pbuf, O_RDONLY);
data/libmtp-1.1.18/util/mtp-probe.c:135: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 pbuf[FILENAME_MAX];
data/libmtp-1.1.18/util/mtp-probe.c:138:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char buf[128];
data/libmtp-1.1.18/util/mtp-probe.c:146:8:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  fd = open(pbuf, O_RDONLY);
data/libmtp-1.1.18/util/mtp-probe.c:164: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 dirbuf[FILENAME_MAX];
data/libmtp-1.1.18/util/mtp-probe.c:235:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char dirbuf[FILENAME_MAX];
data/libmtp-1.1.18/util/mtp-probe.c:299:11:  [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).
  busno = atoi(argv[2]);
data/libmtp-1.1.18/util/mtp-probe.c:300:11:  [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).
  devno = atoi(argv[3]);
data/libmtp-1.1.18/examples/albumart.c:128:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ret = read(fd, imagedata, filesize);
data/libmtp-1.1.18/examples/delfile.c:95:7:  [1] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused). Risk is low because the source is a constant character.
      strcpy(argv[1 + off],"");
data/libmtp-1.1.18/examples/delfile.c:98:7:  [1] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused). Risk is low because the source is a constant character.
      strcpy(argv[1 + off],"0");
data/libmtp-1.1.18/examples/delfile.c:120:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      if (strlen(argv[i]) > 0) {
data/libmtp-1.1.18/examples/detect.c:268:17:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		  readbytes = read(tmpfiledescriptor, (void*) buf, XML_BUFSIZE);
data/libmtp-1.1.18/examples/pathutils.c:44:21:  [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).
  current = malloc (strlen(parent) + strlen(folder->name) + 2);
data/libmtp-1.1.18/examples/pathutils.c:44:38:  [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).
  current = malloc (strlen(parent) + strlen(folder->name) + 2);
data/libmtp-1.1.18/examples/pathutils.c:50: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).
  if (strncasecmp (path, current, strlen (current)) == 0) {
data/libmtp-1.1.18/examples/pathutils.c:233:12:  [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).
  p = in + strlen(in) - 1;
data/libmtp-1.1.18/examples/sendtr.c:236:12:  [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(ptitle)) ptitle = NULL;
data/libmtp-1.1.18/examples/sendtr.c:241:12:  [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(palbum)) palbum = NULL;
data/libmtp-1.1.18/examples/sendtr.c:246:12:  [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(palbumartist)) palbumartist = NULL;
data/libmtp-1.1.18/examples/sendtr.c:251:12:  [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(partist)) partist = NULL;
data/libmtp-1.1.18/examples/sendtr.c:256:12:  [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(pcomposer)) pcomposer = NULL;
data/libmtp-1.1.18/examples/sendtr.c:261:12:  [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(pgenre)) pgenre = NULL;
data/libmtp-1.1.18/examples/thumb.c:95:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ret = read(fd, imagedata, filesize);
data/libmtp-1.1.18/src/libmtp.c:1784: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).
  while (end < strlen(desc)) {
data/libmtp-1.1.18/src/libmtp.c:1786:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    while ((end < strlen(desc)) && (desc[start] == ' ' )) {
data/libmtp-1.1.18/src/libmtp.c:1791:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    while ((end < strlen(desc)) && (desc[end] != ';'))
data/libmtp-1.1.18/src/libmtp.c:1793: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).
    if (end < strlen(desc)) {
data/libmtp-1.1.18/src/libmtp.c:1800:21:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        while ((i < strlen(element)) && (element[i] != ':'))
data/libmtp-1.1.18/src/libmtp.c:1802:17:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        if (i < strlen(element)) {
data/libmtp-1.1.18/src/libmtp.c:5594:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(basename, filename, extension_position - filename);
data/libmtp-1.1.18/src/libmtp.c:5598:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    char newname[ strlen(basename) + 6 + strlen(extension_position)];
data/libmtp-1.1.18/src/libmtp.c:5598:42:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    char newname[ strlen(basename) + 6 + strlen(extension_position)];
data/libmtp-1.1.18/src/libmtp.c:7793:7:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  if (strlen(name) > strlen(suffix)) {
data/libmtp-1.1.18/src/libmtp.c:7793: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).
  if (strlen(name) > strlen(suffix)) {
data/libmtp-1.1.18/src/libmtp.c:7794: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).
    char const * const suff = &name[strlen(name)-strlen(suffix)];
data/libmtp-1.1.18/src/libmtp.c:7794: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).
    char const * const suff = &name[strlen(name)-strlen(suffix)];
data/libmtp-1.1.18/src/libmtp.c:7797:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(fname, name, sizeof(fname));
data/libmtp-1.1.18/src/libmtp.c:7802:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(fname, name, sizeof(fname)-strlen(suffix)-1);
data/libmtp-1.1.18/src/libmtp.c:7802:40:  [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).
    strncpy(fname, name, sizeof(fname)-strlen(suffix)-1);
data/libmtp-1.1.18/src/libopenusb1-glue.c:1797:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
        usleep(1000);
data/libmtp-1.1.18/src/libopenusb1-glue.c:1818:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
        usleep(1000);
data/libmtp-1.1.18/src/libopenusb1-glue.c:1839:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
        usleep(1000);
data/libmtp-1.1.18/src/libopenusb1-glue.c:1860:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
        usleep(1000);
data/libmtp-1.1.18/src/libopenusb1-glue.c:1881:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
        usleep(1000);
data/libmtp-1.1.18/src/libusb-glue.c:1745:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/libusb-glue.c:1752:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/libusb-glue.c:1760:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/libusb-glue.c:1768:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/libusb-glue.c:1776:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/libusb1-glue.c:1027: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(200000);
data/libmtp-1.1.18/src/libusb1-glue.c:2005:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/libusb1-glue.c:2012:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/libusb1-glue.c:2020:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/libusb1-glue.c:2028:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/libusb1-glue.c:2036:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(1000);
data/libmtp-1.1.18/src/mtpz.c:90:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
		size_t newlen = strlen(result);
data/libmtp-1.1.18/src/mtpz.c:127: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).
	int plen = strlen(home) + strlen("/.mtpz-data") + 1;
data/libmtp-1.1.18/src/mtpz.c:127: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).
	int plen = strlen(home) + strlen("/.mtpz-data") + 1;
data/libmtp-1.1.18/src/mtpz.c:151:48:  [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).
	MTPZ_ENCRYPTION_KEY = hex_to_bytes(hexenckey, strlen(hexenckey));
data/libmtp-1.1.18/src/mtpz.c:182:45:  [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).
	MTPZ_CERTIFICATES = hex_to_bytes(hexcerts, strlen(hexcerts));
data/libmtp-1.1.18/src/playlist-spl.c:95: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).
         (strlen(oi->Filename) > 4) &&
data/libmtp-1.1.18/src/playlist-spl.c:96:34:  [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).
         (strcmp((oi->Filename + strlen(oi->Filename) - 4), ".spl") == 0);
data/libmtp-1.1.18/src/playlist-spl.c:123: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).
  pl->name = malloc(sizeof(char)*(strlen(oi->Filename) -4 +1));
data/libmtp-1.1.18/src/playlist-spl.c:124:34:  [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(pl->name, oi->Filename, strlen(oi->Filename) -4);
data/libmtp-1.1.18/src/playlist-spl.c:126:12:  [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).
  pl->name[strlen(oi->Filename) - 4] = 0;
data/libmtp-1.1.18/src/playlist-spl.c:225:38:  [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).
  f->filename = malloc(sizeof(char)*(strlen(pl->name)+5));
data/libmtp-1.1.18/src/playlist-spl.c:306:36:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    char* s = malloc(sizeof(char)*(strlen(newlist->name)+5));
data/libmtp-1.1.18/src/playlist-spl.c:356:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    rdcnt = read(fd, it, sizeof(char)*MAXREAD);
data/libmtp-1.1.18/src/playlist-spl.c:464:15:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    for(i=0;i<strlen(p->text);i++)
data/libmtp-1.1.18/src/playlist-spl.c:685: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).
  iw = iw - (strlen(files->filename) +1); // leave room for '\0' at the end
data/libmtp-1.1.18/src/playlist-spl.c:695: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).
    iw = iw - (strlen(f) +1);
data/libmtp-1.1.18/src/playlist-spl.c:698:8:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    iw[strlen(f)] = '\\';
data/libmtp-1.1.18/src/playlist-spl.c:735:16:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  size_t len = strlen(s);
data/libmtp-1.1.18/src/playlist-spl.c:745: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).
    if(sci + strlen(sci) == sc + len) {
data/libmtp-1.1.18/src/playlist-spl.c:762:12:  [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).
    sci += strlen(sci) +1;
data/libmtp-1.1.18/src/ptp-pack.c:212:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	size_t convlen = strlen(string);
data/libmtp-1.1.18/src/ptp-pack.c:687:17:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	capturedatelen=strlen(capture_date);
data/libmtp-1.1.18/src/ptp-pack.c:713: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).
	ptpdatelen = strlen(str);
data/libmtp-1.1.18/src/ptp-pack.c:722:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy (ptpdate, str, sizeof(ptpdate));
data/libmtp-1.1.18/src/ptp-pack.c:726:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy (tmp, ptpdate, 4);
data/libmtp-1.1.18/src/ptp-pack.c:729:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy (tmp, ptpdate + 4, 2);
data/libmtp-1.1.18/src/ptp-pack.c:732:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy (tmp, ptpdate + 6, 2);
data/libmtp-1.1.18/src/ptp-pack.c:735:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy (tmp, ptpdate + 9, 2);
data/libmtp-1.1.18/src/ptp-pack.c:738:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy (tmp, ptpdate + 11, 2);
data/libmtp-1.1.18/src/ptp-pack.c:741:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy (tmp, ptpdate + 13, 2);
data/libmtp-1.1.18/src/ptp-pack.c:1833:9:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
			p += sprintf(p,",");
data/libmtp-1.1.18/src/ptp-pack.c:1847:7:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
	p += sprintf(p,"}");
data/libmtp-1.1.18/src/ptp-pack.c:2503:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("Button 1234567"));
data/libmtp-1.1.18/src/ptp-pack.c:2571:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("OLCInfo event 0x0010 content 01234567")+1); 
data/libmtp-1.1.18/src/ptp-pack.c:2587:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("OLCInfo event 0x0020 content 0123456789ab")+1); 
data/libmtp-1.1.18/src/ptp-pack.c:2604:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("OLCInfo exposure indicator 012345678901234567890123456789abcd")+1); 
data/libmtp-1.1.18/src/ptp-pack.c:2620:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("OLCInfo event 0x0080 content 01234567")+1); 
data/libmtp-1.1.18/src/ptp-pack.c:2633:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("0123456789ab")+1); 
data/libmtp-1.1.18/src/ptp-pack.c:2648:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("0123456789abcd0123456789abcdef")+1); 
data/libmtp-1.1.18/src/ptp-pack.c:2664:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("OLCInfo event 0x0400 content 0123456789abcd")+1); 
data/libmtp-1.1.18/src/ptp-pack.c:2681:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("OLCInfo event 0x0800 content 0123456789abcdef")+1); 
data/libmtp-1.1.18/src/ptp-pack.c:2698:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("OLCInfo event 0x1000 content 01")+1); 
data/libmtp-1.1.18/src/ptp-pack.c:2707: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).
			ce[i].u.info = malloc(strlen("OLCInfo event mask 0123456789")+1);
data/libmtp-1.1.18/src/ptp-pack.c:2724: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).
			ce[i].u.info = malloc(strlen("BulbExposureTime 123456789012345678"));
data/libmtp-1.1.18/src/ptp-pack.c:2735:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
				ce[i].u.info = malloc(strlen("unhandled EOS event "#x" (size 12345678901)")+1);	\
data/libmtp-1.1.18/src/ptp-pack.c:2827: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 =	2*(strlen(text->title)+1)+1+
data/libmtp-1.1.18/src/ptp-pack.c:2828: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).
		2*(strlen(text->line[0])+1)+1+
data/libmtp-1.1.18/src/ptp-pack.c:2829: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).
		2*(strlen(text->line[1])+1)+1+
data/libmtp-1.1.18/src/ptp-pack.c:2830: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).
		2*(strlen(text->line[2])+1)+1+
data/libmtp-1.1.18/src/ptp-pack.c:2831: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).
		2*(strlen(text->line[3])+1)+1+
data/libmtp-1.1.18/src/ptp-pack.c:2832: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).
		2*(strlen(text->line[4])+1)+1+
data/libmtp-1.1.18/src/ptp.c:347:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	got = read (priv->fd, data, wantlen);
data/libmtp-1.1.18/src/ptp.c:875:2:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
	usleep(500);
data/libmtp-1.1.18/src/ptp.c:905:2:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
	usleep(100000);
data/libmtp-1.1.18/src/ptp.c:912:3:  [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(100000);
data/libmtp-1.1.18/src/ptp.c:3278: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).
			size = strlen(value->str) + 1 + 8;
data/libmtp-1.1.18/src/ptp.c:3508:20:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	data = malloc (2*(strlen(name)+1)+2);
data/libmtp-1.1.18/src/ptp.c:3510: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).
	memset (data, 0, 2*(strlen(name)+1)+2);
data/libmtp-1.1.18/src/ptp.c:4138:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(params->wifi_profiles[profn].profile_name, (char*)&data[pos], n);
data/libmtp-1.1.18/src/ptp.c:4148:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(params->wifi_profiles[profn].creation_date, buffer, sizeof(params->wifi_profiles[profn].creation_date));
data/libmtp-1.1.18/src/ptp.c:4156:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(params->wifi_profiles[profn].lastusage_date, buffer, sizeof(params->wifi_profiles[profn].lastusage_date));
data/libmtp-1.1.18/src/ptp.c:4166:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(params->wifi_profiles[profn].essid, (char*)&data[pos], n);
data/libmtp-1.1.18/src/ptp.c:4243:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy((char*)&buffer[0x05], profile->profile_name, 16);
data/libmtp-1.1.18/src/ptp.c:4266:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy((char*)&buffer[0x4A], profile->essid, 32);
data/libmtp-1.1.18/src/ptp.c:4571:63:  [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).
	CHECK_PTP_RC (ptp_transaction(params, &ptp, PTP_DP_SENDDATA, strlen(remote_fn), (unsigned char**)&remote_fn, NULL));
data/libmtp-1.1.18/src/ptp.c:4599:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  file_name_len = strlen(remote_fn);
data/libmtp-1.1.18/src/ptp.c:4669:62:  [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).
	CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_SENDDATA, strlen(script)+1, (unsigned char**)&script, NULL));
data/libmtp-1.1.18/src/unicode.c:119:20:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  size_t convlen = strlen(localstr)+1; // utf8 bytes, include terminator
data/libmtp-1.1.18/src/unicode.c:159:7:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  k = strlen(str);
data/libmtp-1.1.18/src/util.c:140:16:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  size_t len = strlen (s);
data/libmtp-1.1.18/src/util.c:147:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(ret, s, n);
data/libmtp-1.1.18/util/mtp-hotplug.c:101:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(mtp_probe_dir,optarg,sizeof(mtp_probe_dir));
data/libmtp-1.1.18/util/mtp-hotplug.c:103:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      if (strlen(mtp_probe_dir) <= 1) {
data/libmtp-1.1.18/util/mtp-hotplug.c:108: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).
      if (mtp_probe_dir[strlen(mtp_probe_dir)-1] != '/') {
data/libmtp-1.1.18/util/mtp-hotplug.c:109: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).
	int index = strlen(mtp_probe_dir);
data/libmtp-1.1.18/util/mtp-probe.c:66: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).
  int len = strlen(path);
data/libmtp-1.1.18/util/mtp-probe.c:80:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
  strncpy(pbuf + len, "type", FILENAME_MAX - len);
data/libmtp-1.1.18/util/mtp-probe.c:86:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  bread = read(fd, buf, sizeof(buf));
data/libmtp-1.1.18/util/mtp-probe.c:101:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
  strncpy(pbuf + len, "direction", FILENAME_MAX - len);
data/libmtp-1.1.18/util/mtp-probe.c:107:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  bread = read(fd, buf, sizeof(buf));
data/libmtp-1.1.18/util/mtp-probe.c:136: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).
  int len = strlen(path);
data/libmtp-1.1.18/util/mtp-probe.c:143:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
  strncpy(pbuf + len, "bNumEndpoints", FILENAME_MAX - len);
data/libmtp-1.1.18/util/mtp-probe.c:150:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  bread = read(fd, buf, sizeof(buf));
data/libmtp-1.1.18/util/mtp-probe.c:165: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).
  int len = strlen(sysfspath);
data/libmtp-1.1.18/util/mtp-probe.c:200:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(dirbuf + len, dent->d_name, FILENAME_MAX - len);
data/libmtp-1.1.18/util/mtp-probe.c:236: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).
  int len = strlen(sysfspath);
data/libmtp-1.1.18/util/mtp-probe.c:265:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(dirbuf + len, dent->d_name, FILENAME_MAX - len);

ANALYSIS SUMMARY:

Hits = 372
Lines analyzed = 44771 in approximately 1.30 seconds (34392 lines/second)
Physical Source Lines of Code (SLOC) = 30238
Hits@level = [0] 618 [1] 135 [2] 178 [3]  21 [4]  38 [5]   0
Hits@level+ = [0+] 990 [1+] 372 [2+] 237 [3+]  59 [4+]  38 [5+]   0
Hits/KSLOC@level+ = [0+] 32.7403 [1+] 12.3024 [2+] 7.83782 [3+] 1.95119 [4+] 1.2567 [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.