Changeset 208 in openpam


Ignore:
Timestamp:
May 1, 2003, 6:13:09 PM (15 years ago)
Author:
Dag-Erling Smørgrav
Message:

Avoid dereferencing an unitialized dl handle. Also, add a cast to
avoid a warning about assigning void * to a function pointer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_dynamic.c

    r157 r208  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#6 $
     34 * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#7 $
    3535 */
    3636
     
    5858        int i;
    5959
     60        dlh = NULL;
    6061        if ((module = calloc(1, sizeof *module)) == NULL)
    6162                goto buf_err;
     
    7879        module->dlh = dlh;
    7980        for (i = 0; i < PAM_NUM_PRIMITIVES; ++i) {
    80                 module->func[i] = dlsym(dlh, _pam_sm_func_name[i]);
     81                module->func[i] = (pam_func_t)dlsym(dlh, _pam_sm_func_name[i]);
    8182                if (module->func[i] == NULL)
    8283                        openpam_log(PAM_LOG_DEBUG, "%s: %s(): %s",
     
    8687 buf_err:
    8788        openpam_log(PAM_LOG_ERROR, "%m");
    88         dlclose(dlh);
     89        if (dlh != NULL)
     90                dlclose(dlh);
    8991        free(module);
    9092        return (NULL);
Note: See TracChangeset for help on using the changeset viewer.