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/calibre-5.5.0+dfsg/src/unicode_names/unicode_names.c
Examining data/calibre-5.5.0+dfsg/src/unicode_names/names.h
Examining data/calibre-5.5.0+dfsg/src/unicode_names/data-types.h
Examining data/calibre-5.5.0+dfsg/src/tinycss/tokenizer.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winutil.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winsapi.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/windows/common.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/tts/espeak.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/spell/hunspell_wrapper.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/speedup.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/utils.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/test.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/podofo.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/output.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/outlines.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/outline.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/impose.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/images.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/global.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/fonts.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/doc.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/spr.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/msdesmodule.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/des.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/d3des.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/matcher.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/system.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/mspack.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxmodule.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxc.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxc.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzc.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzc.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/compressor.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/imageops/quantize.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/imageops/ordered_dither.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/imageops/imageops.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/imageops/imageops.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/icu_calibre_utils.h
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/icu.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/hyphenation/hyphen.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/fonts/winfonts.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/fonts/freetype.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/cocoa_wrapper.c
Examining data/calibre-5.5.0+dfsg/src/calibre/utils/certgen.c
Examining data/calibre-5.5.0+dfsg/src/calibre/srv/html_as_json.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/library/sqlite_custom.c
Examining data/calibre-5.5.0+dfsg/src/calibre/headless/main.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/headless/headless_integration.h
Examining data/calibre-5.5.0+dfsg/src/calibre/headless/headless_integration.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/headless/headless_backingstore.h
Examining data/calibre-5.5.0+dfsg/src/calibre/headless/headless_backingstore.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/headless/fontconfig_database.h
Examining data/calibre-5.5.0+dfsg/src/calibre/headless/fontconfig_database.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/gui2/tweak_book/editor/syntax/html.c
Examining data/calibre-5.5.0+dfsg/src/calibre/gui2/tweak_book/diff/_patiencediff_c.c
Examining data/calibre-5.5.0+dfsg/src/calibre/gui2/progress_indicator/QProgressIndicator.h
Examining data/calibre-5.5.0+dfsg/src/calibre/gui2/progress_indicator/QProgressIndicator.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/gui2/pictureflow/pictureflow.h
Examining data/calibre-5.5.0+dfsg/src/calibre/gui2/pictureflow/pictureflow.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/ebooks/pdf/utils.h
Examining data/calibre-5.5.0+dfsg/src/calibre/ebooks/djvu/bzzdecoder.c
Examining data/calibre-5.5.0+dfsg/src/calibre/ebooks/compression/palmdoc.c
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/wpd.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/utils.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/global.h
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/content_enumeration.cpp
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/unix/upstream/music-players.h
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/unix/upstream/device-flags.h
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/unix/libmtp.c
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/unix/devices.h
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/unix/devices.c
Examining data/calibre-5.5.0+dfsg/src/calibre/devices/libusb/libusb.c
Examining data/calibre-5.5.0+dfsg/bypy/windows/util.c
Examining data/calibre-5.5.0+dfsg/bypy/windows/portable.cpp
Examining data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp
Examining data/calibre-5.5.0+dfsg/bypy/windows/main.c
Examining data/calibre-5.5.0+dfsg/bypy/windows/file_dialogs.cpp
Examining data/calibre-5.5.0+dfsg/bypy/windows/eject.c
Examining data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.h
Examining data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp
Examining data/calibre-5.5.0+dfsg/bypy/run-python.h
Examining data/calibre-5.5.0+dfsg/bypy/macos/util.h
Examining data/calibre-5.5.0+dfsg/bypy/macos/util.c
Examining data/calibre-5.5.0+dfsg/bypy/macos/placeholder.c
Examining data/calibre-5.5.0+dfsg/bypy/macos/launcher.c
Examining data/calibre-5.5.0+dfsg/bypy/linux/util.h
Examining data/calibre-5.5.0+dfsg/bypy/linux/util.c
Examining data/calibre-5.5.0+dfsg/bypy/linux/main.c
Examining data/calibre-5.5.0+dfsg/bypy/linux/launcher.c

FINAL RESULTS:

data/calibre-5.5.0+dfsg/bypy/linux/launcher.c:22:9:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
    if (readlink("/proc/self/exe", buf, PATHLEN) == -1) {
data/calibre-5.5.0+dfsg/bypy/linux/util.c:23:8:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
	ret = readlink(linkname, exe_path_char, sizeof(exe_path_char));
data/calibre-5.5.0+dfsg/bypy/linux/launcher.c:41:9:  [4] (shell) execv:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    if (execv(exe, argv) == -1) {
data/calibre-5.5.0+dfsg/bypy/linux/util.c:39:5:  [4] (format) swprintf:
  Potential format string problem (CWE-134). Make format string constant.
    swprintf(interpreter_data.python_lib_path, arraysz(interpreter_data.python_lib_path), L"%ls/lib/python%d.%d", interpreter_data.python_home_path, PY_VERSION_MAJOR, PY_VERSION_MINOR);
data/calibre-5.5.0+dfsg/bypy/linux/util.c:40:5:  [4] (format) swprintf:
  Potential format string problem (CWE-134). Make format string constant.
    swprintf(interpreter_data.resources_path, arraysz(interpreter_data.resources_path), L"%ls/resources", interpreter_data.python_home_path);
data/calibre-5.5.0+dfsg/bypy/linux/util.c:41:5:  [4] (format) swprintf:
  Potential format string problem (CWE-134). Make format string constant.
    swprintf(interpreter_data.extensions_path, arraysz(interpreter_data.extensions_path), L"%ls/lib/calibre-extensions", interpreter_data.python_home_path);
data/calibre-5.5.0+dfsg/bypy/macos/launcher.c:9:22:  [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.
#define fatal(...) { fprintf(stderr, __VA_ARGS__); exit(EXIT_FAILURE); }
data/calibre-5.5.0+dfsg/bypy/macos/launcher.c:26:9:  [4] (shell) execv:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
        execv(path, new_argv);
data/calibre-5.5.0+dfsg/bypy/macos/placeholder.c:40:5:  [4] (shell) execv:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    execv(path, argv);
data/calibre-5.5.0+dfsg/bypy/macos/util.c:49:35:  [4] (format) swprintf:
  Potential format string problem (CWE-134). Make format string constant.
#define set_path(which, fmt, ...) swprintf(interpreter_data.which, arraysz(interpreter_data.which), fmt, interpreter_data.bundle_resource_path, __VA_ARGS__)
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:631:37:  [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.
#define Trace(x) {if (z_verbose>=0) fprintf x ;}
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:632:37:  [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.
#define Tracev(x) {if (z_verbose>0) fprintf x ;}
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:633:38:  [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.
#define Tracevv(x) {if (z_verbose>1) fprintf x ;}
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:634:46:  [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.
#define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:635:47:  [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.
#define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3398:2:  [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(szFileNameA, szFileName);
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3931: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(ze->name,fn);
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4039:2:  [4] (buffer) _tcscpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using a function version that stops copying at the end
  of the buffer.
	_tcscpy(cd,rootdir); 
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4041:2:  [4] (buffer) _tcscat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120).
	_tcscat(cd,dir);	//+++1.2
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4123:4:  [4] (buffer) _tcscpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using a function version that stops copying at the end
  of the buffer.
			_tcscpy(dir,(const TCHAR*)dst); 
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4285: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(zew->name, ze.name);
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4337: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(zew->name, ze.name);
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:87:11:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    ULONG access, storage_type = WPD_STORAGE_TYPE_UNDEFINED;
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:151:103:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
                        if (SUCCEEDED(values->GetUnsignedIntegerValue(WPD_STORAGE_ACCESS_CAPABILITY, &access)) && access == WPD_STORAGE_ACCESS_CAPABILITY_READWRITE) desc = Py_True;
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:161: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(cpath, _PATH_DEV);
data/calibre-5.5.0+dfsg/src/calibre/headless/main.cpp:14:72:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
QPlatformIntegration *HeadlessIntegrationPlugin::create(const QString& system, const QStringList& paramList)
data/calibre-5.5.0+dfsg/src/calibre/headless/main.cpp:16:10:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    if (!system.compare(QLatin1String("headless"), Qt::CaseInsensitive))
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:390:53:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
struct lzxd_stream *lzxd_init(struct mspack_system *system,
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:401:8:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
  if (!system) return NULL;
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:418:29:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
  if (!(lzx = system->alloc(system, sizeof(struct lzxd_stream)))) {
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:423:31:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
  lzx->window = system->alloc(system, (size_t) window_size);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:424:31:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
  lzx->inbuf  = system->alloc(system, (size_t) input_buffer_size);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:433:26:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
  lzx->sys             = system;
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.h:125:60:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
extern struct lzxd_stream *lzxd_init(struct mspack_system *system,
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/system.h:19:20:  [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.
                   printf x ; fputc('\n', stdout); fflush(stdout);} while (0);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/system.h:39:53:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
extern int mspack_sys_filelen(struct mspack_system *system,
data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/output.cpp:55:20:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
            return vsnprintf(NULL, 0, pszFormat, args) + 1;
data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/output.cpp:69:19:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
            res = vsnprintf(buf, lBytes, pszFormat, args);
data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/podofo.cpp:23:13:  [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, msg, args);
data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/podofo.cpp:29:17:  [4] (format) fwprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                fwprintf(stderr, prefix);
data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/podofo.cpp:31:13:  [4] (format) vfwprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
            vfwprintf(stderr, msg, args);
data/calibre-5.5.0+dfsg/bypy/linux/launcher.c:35:11:  [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.
    ldp = getenv("LD_LIBRARY_PATH");
data/calibre-5.5.0+dfsg/bypy/macos/launcher.c:18:18:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
    char *path = realpath(pathbuf, realpath_buf);
data/calibre-5.5.0+dfsg/bypy/macos/placeholder.c:28:18:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
    char *path = realpath(pathbuf, realpath_buf);
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:218:11:  [3] (tmpfile) tempnam:
  Temporary file race condition (CWE-377).
    WCHAR tempnam[MAX_PATH+1] = {0};
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:234:19:  [3] (tmpfile) tempnam:
  Temporary file race condition (CWE-377).
    h = temp_file(tempnam);
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:253:16:  [3] (tmpfile) tempnam:
  Temporary file race condition (CWE-377).
    DeleteFile(tempnam);
data/calibre-5.5.0+dfsg/bypy/windows/portable.cpp:195:10:  [3] (shell) CreateProcess:
  This causes a new process to execute and is difficult to use safely
  (CWE-78). Specify the application path in the first argument, NOT as part
  of the second, or embedded spaces could allow an attacker to force a
  different program to run.
    if (!CreateProcess(NULL, mutable_cmdline,
data/calibre-5.5.0+dfsg/bypy/windows/portable.cpp:195:10:  [3] (shell) CreateProcess:
  This causes a new process to execute and is difficult to use safely
  (CWE-78). Specify the application path in the first argument, NOT as part
  of the second, or embedded spaces could allow an attacker to force a
  different program to run.
    if (!CreateProcess(NULL, mutable_cmdline,
data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winutil.cpp:862:14:  [3] (misc) LoadLibraryEx:
  Ensure that the full path to the library is specified, or current directory
  may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to
  find library path, if you aren't already.
	HMODULE h = LoadLibraryEx(path.ptr(), NULL, flags);
data/calibre-5.5.0+dfsg/bypy/linux/launcher.c:20:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    static char buf[PATHLEN+1] = {0}, lib[PATHLEN+1] = {0}, base[PATHLEN+1] = {0}, exe[PATHLEN+1] = {0}, *ldp = NULL;
data/calibre-5.5.0+dfsg/bypy/linux/util.c:4:8:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static char exe_path_char[PATH_MAX];
data/calibre-5.5.0+dfsg/bypy/linux/util.c:8: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 linkname[256]; /* /proc/<pid>/exe */
data/calibre-5.5.0+dfsg/bypy/macos/launcher.c:14: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 pathbuf[PROC_PIDPATHINFO_MAXSIZE], realpath_buf[PROC_PIDPATHINFO_MAXSIZE * 5];
data/calibre-5.5.0+dfsg/bypy/macos/placeholder.c:20: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 pathbuf[PROC_PIDPATHINFO_MAXSIZE], realpath_buf[PROC_PIDPATHINFO_MAXSIZE * 5];
data/calibre-5.5.0+dfsg/bypy/macos/util.c:15: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[3*PATH_MAX];
data/calibre-5.5.0+dfsg/bypy/run-python.h:38: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(dest, t__, tsz * sizeof(wchar_t)); \
data/calibre-5.5.0+dfsg/bypy/run-python.h:47:2:  [2] (buffer) wchar_t:
  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.
	wchar_t exe_path[PATH_MAX], python_home_path[PATH_MAX], python_lib_path[PATH_MAX];
data/calibre-5.5.0+dfsg/bypy/run-python.h:48:2:  [2] (buffer) wchar_t:
  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.
	wchar_t extensions_path[PATH_MAX], resources_path[PATH_MAX], executables_path[PATH_MAX];
data/calibre-5.5.0+dfsg/bypy/run-python.h:50:2:  [2] (buffer) wchar_t:
  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.
	wchar_t bundle_resource_path[PATH_MAX], frameworks_path[PATH_MAX];
data/calibre-5.5.0+dfsg/bypy/run-python.h:52:2:  [2] (buffer) wchar_t:
  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.
	wchar_t app_dir[PATH_MAX];
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:574: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.
const char * const z_errmsg[10] = { // indexed by 2-zlib_error
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1041: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(p, q, n);
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1068: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(p, q, n);
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1504: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(q, p, t);
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:2684:10:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
	int n = MultiByteToWideChar(CP_ACP,		// code page
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:2836: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(ptr, (char*)stream->buf + stream->pos, toread); DWORD red = toread;
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3393: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 szFileNameA[MAX_PATH];
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3412: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 szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3866:3:  [2] (buffer) TCHAR:
  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.
  TCHAR rootdir[MAX_PATH];
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3881:2:  [2] (buffer) _tcscat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Risk is low because the source is a constant string.
	_tcscat(rootdir,_T("\\"));
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3903:34:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  if (index==czei && index!=-1) {memcpy(ze,&cze,sizeof(ZIPENTRY)); return ZR_OK;}
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3918: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 fn[MAX_PATH];
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3963: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 etype[3]; etype[0]=extra[epos+0]; etype[1]=extra[epos+1]; etype[2]=0;
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3987: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(&cze,ze,sizeof(ZIPENTRY)); czei=index;
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4032:3:  [2] (buffer) TCHAR:
  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.
		TCHAR tmp[MAX_PATH]; 
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4038:2:  [2] (buffer) TCHAR:
  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.
	TCHAR cd[MAX_PATH]; 
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4095:3:  [2] (buffer) TCHAR:
  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.
		TCHAR uname[MAX_PATH];
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4122:4:  [2] (buffer) TCHAR:
  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.
			TCHAR dir[MAX_PATH]; 
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.h:103: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 name[MAX_PATH];       // filename within the zip
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.h:112:3:  [2] (buffer) TCHAR:
  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.
  TCHAR name[MAX_PATH];      // filename within the zip
data/calibre-5.5.0+dfsg/bypy/windows/eject.c:98:8:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static wchar_t dos_device_name[MAX_PATH];
data/calibre-5.5.0+dfsg/bypy/windows/eject.c:378:21:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
int wmain(int argc, wchar_t *argv[ ]) {
data/calibre-5.5.0+dfsg/bypy/windows/file_dialogs.cpp:92:15:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
    int asz = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, src, (int)sz, NULL, 0);
data/calibre-5.5.0+dfsg/bypy/windows/file_dialogs.cpp:96:11:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
    asz = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, src, (int)sz, *ans, asz);
data/calibre-5.5.0+dfsg/bypy/windows/file_dialogs.cpp:123: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[10] = {0};
data/calibre-5.5.0+dfsg/bypy/windows/file_dialogs.cpp:271: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[257] = {0}, secret[SECRET_SIZE + 1] = {0};
data/calibre-5.5.0+dfsg/bypy/windows/main.c:64:12:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    static wchar_t buf[MAX_PATH];  // Cannot use a zero initializer for the array as it generates an implicit call to memset()
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:48: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 msgbuf[1024] = {0};
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:157: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(buf, (void*) ds->in_data, rd);
data/calibre-5.5.0+dfsg/bypy/windows/portable.cpp:50:5:  [2] (buffer) TCHAR:
  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.
    TCHAR buf[BUFSIZE];
data/calibre-5.5.0+dfsg/bypy/windows/portable.cpp:84:12:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    static wchar_t drive[_MAX_DRIVE] = {0};
data/calibre-5.5.0+dfsg/bypy/windows/portable.cpp:85:12:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    static wchar_t buf[BUFSIZE] = {0}, dirpath[_MAX_DIR] = {0}, fname[_MAX_FNAME] = {0}, ext[_MAX_EXT] = {0};
data/calibre-5.5.0+dfsg/bypy/windows/portable.cpp:192:12:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    static wchar_t mutable_cmdline[BUFSIZE] = {0};
data/calibre-5.5.0+dfsg/bypy/windows/util.c:24:8:  [2] (buffer) wchar_t:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static wchar_t qt_prefix_dir[MAX_PATH] = {0};
data/calibre-5.5.0+dfsg/bypy/windows/util.c:28:5:  [2] (buffer) wchar_t:
  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.
    wchar_t buf[MAX_PATH] = {0};
data/calibre-5.5.0+dfsg/bypy/windows/util.c:29:5:  [2] (buffer) wchar_t:
  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.
    wchar_t drive[4] = L"\0\0\0";
data/calibre-5.5.0+dfsg/src/calibre/devices/libusb/libusb.c:26: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[301];
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/unix/libmtp.c:113: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(data, buf, len);
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:60: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[500];
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:154: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 cpath[ MAXPATHLEN ];
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:176: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[500]; long val = 0;
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:300: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 buf[512] = {0};
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:323: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 buf[512] = {0};
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:351: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[512] = {0};
data/calibre-5.5.0+dfsg/src/calibre/ebooks/djvu/bzzdecoder.c:41: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          ffzt[256];
data/calibre-5.5.0+dfsg/src/calibre/ebooks/djvu/bzzdecoder.c:666:13:  [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(pos, state.buf, state.xsize);
data/calibre-5.5.0+dfsg/src/calibre/gui2/pictureflow/pictureflow.cpp:278:12:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  FILE*f = fopen("table.c","wt");
data/calibre-5.5.0+dfsg/src/calibre/gui2/pictureflow/pictureflow.cpp:639:13:  [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(dest, src, x);
data/calibre-5.5.0+dfsg/src/calibre/headless/fontconfig_database.cpp:548:56:  [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.
            if (res != FcResultMatch || !strstr((const char *)cap, capabilityForWritingSystem[j]))
data/calibre-5.5.0+dfsg/src/calibre/library/sqlite_custom.c:68: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(list->vals[list->count]->val, val, sz);
data/calibre-5.5.0+dfsg/src/calibre/library/sqlite_custom.c:102:13:  [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(pos, list->vals[i]->val, list->vals[i]->length);
data/calibre-5.5.0+dfsg/src/calibre/library/sqlite_custom.c:236: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(pos, item->val, item->length);
data/calibre-5.5.0+dfsg/src/calibre/srv/html_as_json.cpp:148: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(PyBytes_AS_STRING(this->buf) + this->used, data, sz);
data/calibre-5.5.0+dfsg/src/calibre/srv/html_as_json.cpp:281:4:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
			char buf[32];
data/calibre-5.5.0+dfsg/src/calibre/srv/html_as_json.cpp:304:4:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
			char buf[32];
data/calibre-5.5.0+dfsg/src/calibre/utils/hyphenation/hyphen.c:50:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char hyphenated_word[2*MAX_CHARS] = {0}, hyphens[MAX_CHARS * 3] = {0}, *word_str;
data/calibre-5.5.0+dfsg/src/calibre/utils/icu.c:941: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 name[512] = {0};
data/calibre-5.5.0+dfsg/src/calibre/utils/icu.c:970: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 name[512] = {0};
data/calibre-5.5.0+dfsg/src/calibre/utils/icu.c:1229: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 version[U_MAX_VERSION_STRING_LENGTH+1] = {0}, uversion[U_MAX_VERSION_STRING_LENGTH+5] = {0};
data/calibre-5.5.0+dfsg/src/calibre/utils/icu_calibre_utils.h:68:13:  [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(ans, data, sz * sizeof(UChar));
data/calibre-5.5.0+dfsg/src/calibre/utils/icu_calibre_utils.h:118: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(ans, PyUnicode_4BYTE_DATA(obj), sz * 4);
data/calibre-5.5.0+dfsg/src/calibre/utils/imageops/imageops.cpp:632:13:  [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(dest + left, src, width * sizeof(QRgb));
data/calibre-5.5.0+dfsg/src/calibre/utils/imageops/imageops.cpp:929:21:  [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(dest, src, xlimit * sizeof(QRgb));
data/calibre-5.5.0+dfsg/src/calibre/utils/imageops/quantize.cpp:40:23:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static const unsigned char BIT_MASK[8] = { 1 << 7, 1 << 6, 1 << 5, 1 << 4, 1 << 3, 1 << 2, 1 << 1, 1 };
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/compressor.c:125:13:  [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, residue->data + residue->offset, nbytes);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/compressor.c:129:13:  [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, residue->data + residue->offset, resrem);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/compressor.c:141: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, input->data + input->offset, nbytes);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/compressor.c:167: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(output->data + output->offset, data, nbytes);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/compressor.c:282: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(residue->data, input->data + input->offset, reslen);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzc.c:127: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).
  int wsize = atoi(argv[1]);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzc.c:165: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 *chartab[256];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxc.c:77:10:  [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 extra_bits[52];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxc.c:357: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 code[18];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:355:17:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static unsigned char extra_bits[51];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:478: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 *window, *runsrc, *rundest, buf[12];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.h:81:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  unsigned char PRETREE_len  [LZX_PRETREE_MAXSYMBOLS  + LZX_LENTABLE_SAFETY];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.h:82: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 MAINTREE_len [LZX_MAINTREE_MAXSYMBOLS + LZX_LENTABLE_SAFETY];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.h:83: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 LENGTH_len   [LZX_LENGTH_MAXSYMBOLS   + LZX_LENTABLE_SAFETY];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.h:84: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 ALIGNED_len  [LZX_ALIGNED_MAXSYMBOLS  + LZX_LENTABLE_SAFETY];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.h:97: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  e8_buf[LZX_FRAME_SIZE];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxmodule.c:48: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(dest, src, bytes);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxmodule.c:76: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(buffer, (unsigned char *)mem->buffer + mem->current_bytes, bytes);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxmodule.c:97: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((unsigned char *)mem->buffer + mem->current_bytes, buffer, bytes);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/mspack.h:265:26:  [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).
  struct mspack_file * (*open)(struct mspack_system *this,
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/mspack.h:899:29:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  struct mscabd_cabinet * (*open) (struct mscab_decompressor *this,
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/mspack.h:1299:27:  [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).
  struct mschmd_header *(*open)(struct mschm_decompressor *this,
data/calibre-5.5.0+dfsg/src/calibre/utils/matcher.c:111: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(si->positions, positions, sizeof(*positions) * stack->needle_len);
data/calibre-5.5.0+dfsg/src/calibre/utils/matcher.c:117: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(positions, si->positions, sizeof(*positions) * stack->needle_len);
data/calibre-5.5.0+dfsg/src/calibre/utils/matcher.c:220:32:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            mem.score = score; memcpy(mem.positions, positions, sizeof(*positions) * m->needle_len);
data/calibre-5.5.0+dfsg/src/calibre/utils/matcher.c:223:32:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            score = mem.score; memcpy(positions, mem.positions, sizeof(*positions) * m->needle_len);
data/calibre-5.5.0+dfsg/src/calibre/utils/matcher.c:228:13:  [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(final_positions, positions, sizeof(*positions) * m->needle_len);
data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/d3des.h:32: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 byte[8];
data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/d3des.h:38: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 dbyte[16];
data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/des.c:48:17:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static unsigned char pc1[56] = {
data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/des.c:54:17:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static unsigned char totrot[16] = {
data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/des.c:57:17:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static unsigned char pc2[48] = {
data/calibre-5.5.0+dfsg/src/calibre/utils/msdes/des.c:68: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 pc1m[56], pcr[56];
data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/global.h:73: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(PyBytes_AS_STRING(old) + old_sz, buf, sz);
data/calibre-5.5.0+dfsg/src/calibre/utils/podofo/output.cpp:105:21:  [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(pBuffer, buf, len);
data/calibre-5.5.0+dfsg/src/calibre/utils/speedup.c:157: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 header[100] = {0};
data/calibre-5.5.0+dfsg/src/calibre/utils/speedup.c:196: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(ppm, header, strlen(header));
data/calibre-5.5.0+dfsg/src/calibre/utils/speedup.c:512: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 ltagname[16];
data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winsapi.cpp:189:13:  [2] (buffer) wchar_t:
  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.
            wchar_t buf[LOCALE_NAME_MAX_LENGTH];
data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winutil.cpp:302:5:  [2] (buffer) wchar_t:
  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.
    wchar_t wbuf[MAX_PATH] = {0};
data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winutil.cpp:358:5:  [2] (buffer) wchar_t:
  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.
    wchar_t buf[UNLEN + 1] = {0};
data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winutil.cpp:369:5:  [2] (buffer) wchar_t:
  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.
    wchar_t buf[MAX_PATH + 8] = {0};
data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winutil.cpp:378:5:  [2] (buffer) wchar_t:
  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.
    wchar_t buf[LOCALE_NAME_MAX_LENGTH + 1] = {0};
data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winutil.cpp:602:2:  [2] (buffer) wchar_t:
  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.
	wchar_t buf[2048];
data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winutil.cpp:613:2:  [2] (buffer) wchar_t:
  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.
	wchar_t buf[2048], *p;
data/calibre-5.5.0+dfsg/src/calibre/utils/windows/winutil.cpp:702:3:  [2] (buffer) wchar_t:
  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.
		wchar_t buf[2048];
data/calibre-5.5.0+dfsg/bypy/linux/launcher.c:26:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(lib, buf, PATHLEN);
data/calibre-5.5.0+dfsg/bypy/linux/launcher.c:27:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(base, dirname(lib), PATHLEN);
data/calibre-5.5.0+dfsg/bypy/linux/launcher.c:36:22:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    if (ldp == NULL) strncpy(buf, lib, PATHLEN);
data/calibre-5.5.0+dfsg/bypy/linux/util.c:31:5:  [1] (buffer) wcsncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or
  automatically resizing strings.
    wcsncat(interpreter_data.python_home_path, interpreter_data.exe_path, p - interpreter_data.exe_path);
data/calibre-5.5.0+dfsg/bypy/linux/util.c:37:5:  [1] (buffer) wcsncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or
  automatically resizing strings.
    wcsncat(interpreter_data.executables_path, interpreter_data.python_home_path, home_len);
data/calibre-5.5.0+dfsg/bypy/macos/placeholder.c:39:44:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    snprintf(t + 1, sizeof(realpath_buf) - strlen(path), "%s/%s", REL_PATH, EXE_NAME);
data/calibre-5.5.0+dfsg/bypy/macos/util.c:20: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).
        if (strstr(val, EXE) == val && strlen(val) >= sizeof(EXE)) {
data/calibre-5.5.0+dfsg/bypy/macos/util.c:46:14:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
	cat_literal(strncat, path, "/Contents");
data/calibre-5.5.0+dfsg/bypy/macos/util.c:57:14:  [1] (buffer) wcsncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or
  automatically resizing strings.
	cat_literal(wcsncat, interpreter_data.bundle_resource_path, L"/Resources");
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:820:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  Byte *read;          // window read pointer 
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:842:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
#define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:844:32:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1024:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  q = s->read;
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1296:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      if (s->read != s->write)
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1510:39:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
              z->total_out + (q >= s->read ? q - s->read :
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1510:53:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
              z->total_out + (q >= s->read ? q - s->read :
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1511:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
              (s->end - s->read) + (q - s->window))));
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1639:39:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
              z->total_out + (q >= s->read ? q - s->read :
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1639:53:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
              z->total_out + (q >= s->read ? q - s->read :
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1640:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
              (s->end - s->read) + (q - s->window))));
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:1649:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      if (s->read != s->write)
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:3390:9:  [1] (buffer) _tcslen:
  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 (_tcslen(szFileName)>=UNZ_MAXFILENAMEINZIP)
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4033:3:  [1] (buffer) _tcsncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		_tcsncpy(tmp, dir, lastslash-dir);
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4211: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).
  unsigned int mlen=(unsigned int)strlen(msg);
data/calibre-5.5.0+dfsg/bypy/windows/XUnzip.cpp:4214:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(buf,msg,n); buf[n]=0;
data/calibre-5.5.0+dfsg/bypy/windows/eject.c:32:14:  [1] (buffer) wcslen:
  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).
            (wcslen(msg) + wcslen(preamble) + 80));
data/calibre-5.5.0+dfsg/bypy/windows/eject.c:32:28:  [1] (buffer) wcslen:
  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).
            (wcslen(msg) + wcslen(preamble) + 80));
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:35:14:  [1] (buffer) wcslen:
  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).
            (wcslen(msg) + wcslen(preamble) + 80));
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:35:28:  [1] (buffer) wcslen:
  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).
            (wcslen(msg) + wcslen(preamble) + 80));
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:53:14:  [1] (buffer) wcslen:
  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).
            (wcslen(preamble) + wcslen(msg) + 1100));
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:53:33:  [1] (buffer) wcslen:
  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).
            (wcslen(preamble) + wcslen(msg) + 1100));
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:567:13:  [1] (buffer) wcslen:
  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 (wcslen(fdest) > 58) {
data/calibre-5.5.0+dfsg/bypy/windows/portable-installer.cpp:575:14:  [1] (buffer) wcslen:
  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 (wcslen(fdest) > 58);
data/calibre-5.5.0+dfsg/bypy/windows/portable.cpp:37:14:  [1] (buffer) _tcslen:
  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).
            (_tcslen(msg) + _tcslen(preamble) + 80));
data/calibre-5.5.0+dfsg/bypy/windows/portable.cpp:37:29:  [1] (buffer) _tcslen:
  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).
            (_tcslen(msg) + _tcslen(preamble) + 80));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:152:70:  [1] (buffer) wcslen:
  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).
                        soid = PyUnicode_FromWideChar(object_ids[i], wcslen(object_ids[i]));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:158:77:  [1] (buffer) wcslen:
  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).
                                desc = PyUnicode_FromWideChar(storage_desc, wcslen(storage_desc));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:163:77:  [1] (buffer) wcslen:
  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).
                                desc = PyUnicode_FromWideChar(storage_desc, wcslen(storage_desc));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:168:77:  [1] (buffer) wcslen:
  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).
                                desc = PyUnicode_FromWideChar(storage_desc, wcslen(storage_desc));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:188:59:  [1] (buffer) wcslen:
  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).
                        desc = PyUnicode_FromWideChar(st, wcslen(st));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:278:42:  [1] (buffer) wcslen:
  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).
        t = PyUnicode_FromWideChar(temp, wcslen(temp));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:312:42:  [1] (buffer) wcslen:
  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).
        t = PyUnicode_FromWideChar(temp, wcslen(temp));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:318:42:  [1] (buffer) wcslen:
  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).
        t = PyUnicode_FromWideChar(temp, wcslen(temp));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:324:42:  [1] (buffer) wcslen:
  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).
        t = PyUnicode_FromWideChar(temp, wcslen(temp));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:330:42:  [1] (buffer) wcslen:
  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).
        t = PyUnicode_FromWideChar(temp, wcslen(temp));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/device_enumeration.cpp:336:42:  [1] (buffer) wcslen:
  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).
        t = PyUnicode_FromWideChar(temp, wcslen(temp));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/utils.cpp:21:42:  [1] (buffer) wcslen:
  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).
        o = PyUnicode_FromWideChar(desc, wcslen(desc));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/utils.cpp:49:37:  [1] (buffer) wcslen:
  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).
    ans = PyUnicode_FromWideChar(o, wcslen(o));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/wpd.cpp:114:66:  [1] (buffer) wcslen:
  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).
                temp = PyUnicode_FromWideChar(pnp_device_ids[i], wcslen(pnp_device_ids[i]));
data/calibre-5.5.0+dfsg/src/calibre/devices/mtp/windows/wpd.cpp:147:9:  [1] (buffer) wcslen:
  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 (wcslen(pnp_id) < 1) { PyErr_SetString(WPDError, "The PNP id must not be empty."); return NULL; }
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:68: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).
    return PyUnicode_DecodeUTF8(buf, strlen(buf), "replace");
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:162:23:  [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).
    dev_path_length = strlen(cpath);
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:169: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).
    return PyUnicode_DecodeUTF8(cpath, strlen(cpath), "replace");
data/calibre-5.5.0+dfsg/src/calibre/devices/usbobserver/usbobserver.c:186:41:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        ans = PyUnicode_DecodeUTF8(buf, strlen(buf), "replace");
data/calibre-5.5.0+dfsg/src/calibre/library/sqlite_custom.c:203:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    len = strlen(key) + strlen(val) + 1;
data/calibre-5.5.0+dfsg/src/calibre/library/sqlite_custom.c:203: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).
    len = strlen(key) + strlen(val) + 1;
data/calibre-5.5.0+dfsg/src/calibre/utils/fonts/winfonts.cpp:38:37:  [1] (buffer) wcslen:
  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).
    ans = PyUnicode_FromWideChar(o, wcslen(o));
data/calibre-5.5.0+dfsg/src/calibre/utils/hyphenation/hyphen.c:57: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).
    size_t wd_size = strlen(word_str);
data/calibre-5.5.0+dfsg/src/calibre/utils/hyphenation/hyphen.c:79:43:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	return PyUnicode_Decode(hyphenated_word, strlen(hyphenated_word), dict->cset, "replace");
data/calibre-5.5.0+dfsg/src/calibre/utils/icu.c:17:43:  [1] (buffer) wcslen:
  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).
        ans = PyUnicode_FromWideChar(buf, wcslen(buf));
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:134:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int read = lzx->sys->read(lzx->input, &lzx->inbuf[0], (int)lzx->inbuf_size);
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:135:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  if (read < 0) return lzx->error = MSPACK_ERR_READ;
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/lzxd.c:152:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  lzx->i_end = &lzx->inbuf[read];
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/mspack.h:289:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int (*read)(struct mspack_file *file,
data/calibre-5.5.0+dfsg/src/calibre/utils/lzx/system.h:58: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).
static inline size_t strlen(const char *s) {
data/calibre-5.5.0+dfsg/src/calibre/utils/speedup.c:38:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    len = strlen(raw);
data/calibre-5.5.0+dfsg/src/calibre/utils/speedup.c:106: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).
                l = (int)(strlen(buf) - 1);
data/calibre-5.5.0+dfsg/src/calibre/utils/speedup.c:171: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).
    ppm = (unsigned char*)calloc(strlen(header) + (3 * width * height), sizeof(unsigned char));
data/calibre-5.5.0+dfsg/src/calibre/utils/speedup.c:196: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).
    memcpy(ppm, header, strlen(header));
data/calibre-5.5.0+dfsg/src/calibre/utils/speedup.c:197: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).
    t = ppm + strlen(header);
data/calibre-5.5.0+dfsg/src/unicode_names/unicode_names.c:63: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).
    return codepoints_for_word(word, strlen(word));

ANALYSIS SUMMARY:

Hits = 242
Lines analyzed = 102210 in approximately 5.75 seconds (17786 lines/second)
Physical Source Lines of Code (SLOC) = 91784
Hits@level = [0]  79 [1]  71 [2] 121 [3]   9 [4]  39 [5]   2
Hits@level+ = [0+] 321 [1+] 242 [2+] 171 [3+]  50 [4+]  41 [5+]   2
Hits/KSLOC@level+ = [0+] 3.49734 [1+] 2.63663 [2+] 1.86307 [3+] 0.544757 [4+] 0.446701 [5+] 0.0217903
Dot directories skipped = 2 (--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.