#739 Uninitilized variables in the file context structure
Closed: Fixed None Opened 13 years ago by dpal.

Members need to be set to NULL or malloc+memset() or calloc() should be used.

   52/* Create a file object for parsing a config file */
   53int ini_config_file_open(const char *filename,
   54                         int error_level,
   55                         uint32_t collision_flags,
   56                         uint32_t metadata_flags,
   57                         struct ini_cfgfile **file_ctx)
   58{
   59    int error = EOK;
Declaring variable "new_ctx".
   60    struct ini_cfgfile *new_ctx = NULL;
   61
   62    TRACE_FLOW_ENTRY();
   63
At conditional (1): "!filename" taking the false branch.
At conditional (2): "!file_ctx" taking the false branch.
   64    if ((!filename) || (!file_ctx)) {
   65        TRACE_ERROR_NUMBER("Invalid parameter.", EINVAL);
   66        return EINVAL;
   67    }
   68
   69    /* Allocate structure */
   70    errno = 0;
Assigning: "new_ctx" = "malloc(sizeof (struct ini_cfgfile) /*56*/)", which is allocated but not initialized.
   71    new_ctx = malloc(sizeof(struct ini_cfgfile));
At conditional (3): "!new_ctx" taking the false branch.
   72    if (!new_ctx) {
   73        error = errno;
   74        TRACE_ERROR_NUMBER("Failed to allocate file ctx.", error);
   75        return error;
   76    }
   77
   78    /* Construct the full file path */
   79    errno = 0;
   80    new_ctx->filename = malloc(PATH_MAX + 1);
At conditional (4): "!new_ctx->filename" taking the true branch.
   81    if (!(new_ctx->filename)) {
   82        error = errno;
Using uninitialized value "new_ctx->error_list" when calling "ini_config_file_close". [show details]
Using uninitialized value "new_ctx->file" when calling "ini_config_file_close". [show details]
Using uninitialized value "new_ctx->metadata" when calling "ini_config_file_close". [show details]
   83        ini_config_file_close(new_ctx);
   84        TRACE_ERROR_NUMBER("Failed to allocate memory for file path.", error);
   85        return error;
   86    }
   87
   88    /* Construct path */
   89    error = make_normalized_absolute_path(new_ctx->filename,
   90                                          PATH_MAX,
   91                                          filename);
   92    if(error) {
   93        TRACE_ERROR_NUMBER("Failed to resolve path", error);
Using uninitialized value "new_ctx->file" when calling "ini_config_file_close". [show details]
Using uninitialized value "new_ctx->error_list" when calling "ini_config_file_close". [show details]
Using uninitialized value "new_ctx->metadata" when calling "ini_config_file_close". [show details]
   94        ini_config_file_close(new_ctx);
   95        return error;
   96    }

Fields changed

summary: Uninitilized varibles in the file context structure => Uninitilized variables in the file context structure

Fields changed

summary: Uninitilized varibles in the file context structure => Uninitilized variables in the file context structure

Fields changed

summary: Uninitilized varibles in the file context structure => Uninitilized variables in the file context structure

Fields changed

coverity: => 10049
keywords: => Coverity

Fields changed

coverity: => 10049
keywords: => Coverity

Fields changed

coverity: => 10049
keywords: => Coverity

Fields changed

rhbz: => 0

Fields changed

rhbz: => 0

Fields changed

rhbz: => 0

Based on the code inspection of the function ini_config_file_open() the issue should not exist any more in the current code. All the parts of the structure are properly initialized.

blockedby: =>
blocking: =>
feature_milestone: =>
milestone: Tools Backlog => Tools 1.0
patch: => 0
resolution: => fixed
status: new => closed

Based on the code inspection of the function ini_config_file_open() the issue should not exist any more in the current code. All the parts of the structure are properly initialized.

blockedby: =>
blocking: =>
feature_milestone: =>
milestone: Tools Backlog => Tools 1.0
patch: => 0
resolution: => fixed
status: new => closed

Based on the code inspection of the function ini_config_file_open() the issue should not exist any more in the current code. All the parts of the structure are properly initialized.

blockedby: =>
blocking: =>
feature_milestone: =>
milestone: Tools Backlog => Tools 1.0
patch: => 0
resolution: => fixed
status: new => closed

Metadata Update from @dpal:
- Issue set to the milestone: Tools 1.0

7 years ago

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/1781

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata