Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-292

Erroneous malloc() result check in mariadb_dyncol_val_double()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.0.3
    • Labels:
      None

      Description

      mariadb_dyncol_val_double() function (defined in libmariadb/mariadb_dyncol.c) has the following code:

        if ((str= malloc(val->x.string.value.length + 1)))
          return ER_DYNCOL_RESOURCE;
        memcpy(str, val->x.string.value.str, val->x.string.value.length);
      

      Shouldn't it be

        if ((str= malloc(val->x.string.value.length + 1)) == NULL)
        ...
      

      instead?

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            karen Karen Arutyunov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: