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/libmbim-1.24.4/build-aux/templates/mbim-error-quarks-template.c
Examining data/libmbim-1.24.4/build-aux/templates/mbim-enum-types-template.h
Examining data/libmbim-1.24.4/build-aux/templates/mbim-error-types-template.c
Examining data/libmbim-1.24.4/build-aux/templates/mbim-error-types-template.h
Examining data/libmbim-1.24.4/build-aux/templates/mbim-enum-types-template.c
Examining data/libmbim-1.24.4/src/mbim-proxy/mbim-proxy.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-intel-firmware-update.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-ms-basic-connect-extensions.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli.h
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-phonebook.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-basic-connect.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-helpers.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-helpers.h
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-ms-host-shutdown.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-dss.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-atds.c
Examining data/libmbim-1.24.4/src/mbimcli/mbimcli-ms-firmware-id.c
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-cid.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-version.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-cid.c
Examining data/libmbim-1.24.4/src/libmbim-glib/test/test-message.c
Examining data/libmbim-1.24.4/src/libmbim-glib/test/test-uuid.c
Examining data/libmbim-1.24.4/src/libmbim-glib/test/test-message-builder.c
Examining data/libmbim-1.24.4/src/libmbim-glib/test/test-cid.c
Examining data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c
Examining data/libmbim-1.24.4/src/libmbim-glib/test/test-message-parser.c
Examining data/libmbim-1.24.4/src/libmbim-glib/test/test-fragment.c
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-uuid.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-device.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-device.c
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-message-private.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-compat.c
Examining data/libmbim-1.24.4/src/libmbim-glib/libmbim-glib.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-message.c
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-utils.c
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-message.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.c
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-utils.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-errors.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-uuid.c
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy.c
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-enums.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy.h
Examining data/libmbim-1.24.4/src/libmbim-glib/mbim-compat.h
Examining data/libmbim-1.24.4/src/common/test/test-common.c
Examining data/libmbim-1.24.4/src/common/mbim-common.c
Examining data/libmbim-1.24.4/src/common/mbim-common.h

FINAL RESULTS:

data/libmbim-1.24.4/src/libmbim-glib/mbim-device.c:931:16:  [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.
        path = realpath (tmp, NULL);
data/libmbim-1.24.4/src/libmbim-glib/mbim-utils.c:94:11:  [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.
    aux = realpath (cdc_wdm_path, NULL);
data/libmbim-1.24.4/src/libmbim-glib/mbim-device.c:1076:10:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    fd = open (self->priv->path, O_RDWR | O_EXCL | O_NONBLOCK | O_NOCTTY);
data/libmbim-1.24.4/src/libmbim-glib/mbim-message-private.h:119:40:  [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 open_message            open;
data/libmbim-1.24.4/src/libmbim-glib/mbim-message.c:648: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 (&((*array)[i]),
data/libmbim-1.24.4/src/libmbim-glib/mbim-message.c:748: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 (&((*array)[i]),
data/libmbim-1.24.4/src/libmbim-glib/mbim-message.c:789: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 (&offset_value, &(builder->fixed_buffer->data[offset_offset]), sizeof (guint32));
data/libmbim-1.24.4/src/libmbim-glib/mbim-message.c:791: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 (&(builder->fixed_buffer->data[offset_offset]), &offset_value, sizeof (guint32));
data/libmbim-1.24.4/src/libmbim-glib/mbim-message.c:1771:52:  [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 full_message *)(self->data))->message.open.max_control_transfer = GUINT32_TO_LE (max_control_transfer);
data/libmbim-1.24.4/src/libmbim-glib/mbim-message.c:1782:76:  [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).
    return GUINT32_FROM_LE (((struct full_message *)(self->data))->message.open.max_control_transfer);
data/libmbim-1.24.4/src/libmbim-glib/mbim-message.c:1976: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 (((struct full_message *)(self->data))->message.command.service_id, service_id, sizeof (*service_id));
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.c:180: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 (&(array[i]->device_service_id), uuid, 16);
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.c:311: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 (&entry_out->device_service_id, &entry_in->device_service_id, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.c:314: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 (entry_out->cids, entry_in->cids, sizeof (guint32) * entry_out->cids_count);
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.c:353: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 (&entry->device_service_id, mbim_uuid_from_service (MBIM_SERVICE_BASIC_CONNECT), sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.c:368: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 (&entry->device_service_id, mbim_uuid_from_service (MBIM_SERVICE_SMS), sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.c:381: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 (&entry->device_service_id, mbim_uuid_from_service (MBIM_SERVICE_USSD), sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.c:394: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 (&entry->device_service_id, mbim_uuid_from_service (MBIM_SERVICE_PHONEBOOK), sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy-helpers.c:407: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 (&entry->device_service_id, mbim_uuid_from_service (MBIM_SERVICE_STK), sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy.c:657: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 (command_done->service_id, MBIM_UUID_PROXY_CONTROL, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy.c:866: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 (command_done->service_id, MBIM_UUID_BASIC_CONNECT, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/mbim-proxy.c:870: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 (&command_done->buffer[0], raw_data, raw_len);
data/libmbim-1.24.4/src/libmbim-glib/mbim-uuid.c:98: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 (uuid, tmp, sizeof (tmp));
data/libmbim-1.24.4/src/libmbim-glib/mbim-uuid.c:253: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 (&s->uuid, uuid, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-message-builder.c:462: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 (&(entries[0]->device_service_id), MBIM_UUID_BASIC_CONNECT, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-message-builder.c:469: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 (&(entries[1]->device_service_id), MBIM_UUID_SMS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-message-builder.c:974: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 (filters[0]->packet_filter, filter, 7);
data/libmbim-1.24.4/src/libmbim-glib/test/test-message-builder.c:976: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 (filters[0]->packet_mask, mask, 7);
data/libmbim-1.24.4/src/libmbim-glib/test/test-message-builder.c:1082: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 (filters[0]->packet_filter, filter1, 8);
data/libmbim-1.24.4/src/libmbim-glib/test/test-message-builder.c:1084: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 (filters[0]->packet_mask, mask1, 8);
data/libmbim-1.24.4/src/libmbim-glib/test/test-message-builder.c:1088: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 (filters[1]->packet_filter, filter2, 12);
data/libmbim-1.24.4/src/libmbim-glib/test/test-message-builder.c:1090: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 (filters[1]->packet_mask, mask2, 12);
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:37: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 (&in[0]->device_service_id, MBIM_UUID_BASIC_CONNECT, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.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 (&in[0]->device_service_id, MBIM_UUID_BASIC_CONNECT, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:100: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 (&in[0]->device_service_id, MBIM_UUID_BASIC_CONNECT, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:154: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 (&addition[0]->device_service_id, MBIM_UUID_BASIC_CONNECT, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:163: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 (&addition[1]->device_service_id, MBIM_UUID_SMS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:192: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 (&addition[0]->device_service_id, MBIM_UUID_ATDS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:201: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 (&addition[1]->device_service_id, MBIM_UUID_QMI, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:232: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[0]->device_service_id, MBIM_UUID_ATDS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:242: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 (&addition[0]->device_service_id, MBIM_UUID_ATDS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:256: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 (&expected[0]->device_service_id, MBIM_UUID_ATDS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:289: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[0]->device_service_id, MBIM_UUID_ATDS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:299: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 (&addition[0]->device_service_id, MBIM_UUID_QMI, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:311: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 (&expected[0]->device_service_id, MBIM_UUID_ATDS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:317: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 (&expected[1]->device_service_id, MBIM_UUID_QMI, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:346: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[0]->device_service_id, MBIM_UUID_ATDS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:353: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[1]->device_service_id, MBIM_UUID_QMI, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:362: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 (&addition[0]->device_service_id, MBIM_UUID_ATDS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:367: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 (&addition[1]->device_service_id, MBIM_UUID_MS_HOST_SHUTDOWN, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:379: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 (&expected[0]->device_service_id, MBIM_UUID_ATDS, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:387: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 (&expected[1]->device_service_id, MBIM_UUID_QMI, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/test/test-proxy-helpers.c:392: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 (&expected[2]->device_service_id, MBIM_UUID_MS_HOST_SHUTDOWN, sizeof (MbimUuid));
data/libmbim-1.24.4/src/libmbim-glib/mbim-uuid.c:72:9:  [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 (str) != 36)
data/libmbim-1.24.4/src/mbimcli/mbimcli-basic-connect.c:1016:64:  [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 (errno || n < 0 || n > 255 || ((size_t)(endptr - str) < strlen (str))) {
data/libmbim-1.24.4/src/mbimcli/mbimcli-ms-basic-connect-extensions.c:114:64:  [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 (errno || n < 0 || n > 255 || ((size_t)(endptr - str) < strlen (str))) {

ANALYSIS SUMMARY:

Hits = 56
Lines analyzed = 22145 in approximately 0.56 seconds (39681 lines/second)
Physical Source Lines of Code (SLOC) = 14858
Hits@level = [0]   1 [1]   3 [2]  51 [3]   2 [4]   0 [5]   0
Hits@level+ = [0+]  57 [1+]  56 [2+]  53 [3+]   2 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 3.83632 [1+] 3.76901 [2+] 3.5671 [3+] 0.134608 [4+]   0 [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.