Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-21916

Address issues found in static analysis

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • rhel-9.4
    • cyrus-sasl
    • None
    • None
    • None
    • rhel-sst-idm-ipa
    • ssg_idm
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • None

      Static code analysis was done and uncovered a few issues that warrant further investigation. There is some duplication in this list.

      ---------------------------------

      {{Error: OVERRUN (CWE-119):
      cyrus-sasl-2.1.27/lib/common.c:2288: cond_at_most: Checking "i >= 1025" implies that "i" may be up to 1024 on the false branch.
      cyrus-sasl-2.1.27/lib/common.c:2287: incr: Incrementing "i". The value of "i" may now be up to 1025.
      cyrus-sasl-2.1.27/lib/common.c:2292: overrun-local: Overrunning array "hbuf" of 1025 bytes at byte offset 1025 using index "i" (which evaluates to 1025).

      1. 2290| hbuf[i] = addr[i];
      2. 2291| }
      3. 2292|-> hbuf[i] = '\0';
      4. 2293|
      5. 2294| if (addr[i] == ';')}}

      ---------------------------------

      {{"Error: RESOURCE_LEAK (CWE-772):
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:386: alloc_arg: ""krb5_init_context"" allocates memory that is stored into ""context"".
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:393: leaked_storage: Variable ""context"" going out of scope leaks the storage it points to.

      1. 391| if (form_principal_name(user, service, realm, principalbuf, sizeof (principalbuf))) { # 392| syslog(LOG_ERR, ""auth_krb5: form_principal_name""); # 393|-> return strdup(""NO saslauthd principal name error""); # 394| }
      2. 395| "
        }}
        ---------------------------------

      {{"Error: RESOURCE_LEAK (CWE-772):
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:396: alloc_arg: ""krb5_parse_name"" allocates memory that is stored into ""auth_user"".
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:404: leaked_storage: Variable ""auth_user"" going out of scope leaks the storage it points to.

      1. 402| if (krbtf_name(tfname, sizeof (tfname)) != 0) { # 403| syslog(LOG_ERR, ""auth_krb5: could not generate ticket file name""); # 404|-> return strdup(""NO saslauthd internal error""); # 405| }
      2. 406| "}}

      ---------------------------------

      {{"Error: RESOURCE_LEAK (CWE-772):
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:386: alloc_arg: ""krb5_init_context"" allocates memory that is stored into ""context"".
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:396: noescape: Resource ""context"" is not freed or pointed-to in ""krb5_parse_name"".
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:404: leaked_storage: Variable ""context"" going out of scope leaks the storage it points to.

      1. 402| if (krbtf_name(tfname, sizeof (tfname)) != 0) { # 403| syslog(LOG_ERR, ""auth_krb5: could not generate ticket file name""); # 404|-> return strdup(""NO saslauthd internal error""); # 405| }
      2. 406| "}}

      ---------------------------------

      {{Error: OVERRUN (CWE-119):
      cyrus-sasl-2.1.27/saslauthd/testsaslauthd.c:224: cond_at_least: Checking "count < 2" implies that "count" is at least 2 on the false branch.
      cyrus-sasl-2.1.27/saslauthd/testsaslauthd.c:230: cond_at_least: Checking "1024 < count" implies that "count" is at least 1025 on the true branch.
      cyrus-sasl-2.1.27/saslauthd/testsaslauthd.c:230: assignment: Assigning: "count" = "(1024 < count) ? 1024UL : count". The value of "count" is now 1024.
      cyrus-sasl-2.1.27/saslauthd/testsaslauthd.c:236: overrun-local: Overrunning array "response" of 1024 bytes at byte offset 1024 using index "count" (which evaluates to 1024).

      1. 234| return -1;
      2. 235| }
      3. 236|-> response[count] = '\0';
      4. 237|
      5. 238| close(s);}}

      ---------------------------------

      {{"Error: RESOURCE_LEAK (CWE-772):
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:386: alloc_arg: ""krb5_init_context"" allocates memory that is stored into ""context"".
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:393: leaked_storage: Variable ""context"" going out of scope leaks the storage it points to.

      1. 391| if (form_principal_name(user, service, realm, principalbuf, sizeof (principalbuf))) { # 392| syslog(LOG_ERR, ""auth_krb5: form_principal_name""); # 393|-> return strdup(""NO saslauthd principal name error""); # 394| }
      2. 395| "}}

      ---------------------------------

      {{"Error: RESOURCE_LEAK (CWE-772):
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:396: alloc_arg: ""krb5_parse_name"" allocates memory that is stored into ""auth_user"".
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:404: leaked_storage: Variable ""auth_user"" going out of scope leaks the storage it points to.

      1. 402| if (krbtf_name(tfname, sizeof (tfname)) != 0) { # 403| syslog(LOG_ERR, ""auth_krb5: could not generate ticket file name""); # 404|-> return strdup(""NO saslauthd internal error""); # 405| }
      2. 406| "}}

      ---------------------------------

      {{"Error: RESOURCE_LEAK (CWE-772):
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:386: alloc_arg: ""krb5_init_context"" allocates memory that is stored into ""context"".
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:396: noescape: Resource ""context"" is not freed or pointed-to in ""krb5_parse_name"".
      cyrus-sasl-2.1.27/saslauthd/auth_krb5.c:404: leaked_storage: Variable ""context"" going out of scope leaks the storage it points to.

      1. 402| if (krbtf_name(tfname, sizeof (tfname)) != 0) { # 403| syslog(LOG_ERR, ""auth_krb5: could not generate ticket file name""); # 404|-> return strdup(""NO saslauthd internal error""); # 405| }
      2. 406| "}}
        ---------------------------------

              rhn-engineering-rcrit Rob Crittenden
              rhn-engineering-rcrit Rob Crittenden
              Rob Crittenden Rob Crittenden
              Michal Polovka Michal Polovka
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: