Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninitilized variables in the file context structure #1781

Closed
sssd-bot opened this issue May 2, 2020 · 0 comments
Closed

Uninitilized variables in the file context structure #1781

sssd-bot opened this issue May 2, 2020 · 0 comments
Labels
Closed: Fixed Issue was closed as fixed.

Comments

@sssd-bot
Copy link

sssd-bot commented May 2, 2020

Cloned from Pagure issue: https://pagure.io/SSSD/sssd/issue/739

  • Created at 2010-12-17 02:00:06 by dpal
  • Closed as Fixed
  • Assigned to nobody

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    }

Comments


Comment from dpal at 2010-12-17 02:00:22

Fields changed

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


Comment from dpal at 2010-12-17 02:00:22

Fields changed

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


Comment from dpal at 2010-12-17 02:00:22

Fields changed

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


Comment from sgallagh at 2010-12-17 14:28:54

Fields changed

coverity: => 10049
keywords: => Coverity


Comment from sgallagh at 2010-12-17 14:28:54

Fields changed

coverity: => 10049
keywords: => Coverity


Comment from sgallagh at 2010-12-17 14:28:54

Fields changed

coverity: => 10049
keywords: => Coverity


Comment from dpal at 2012-01-19 03:26:28

Fields changed

rhbz: => 0


Comment from dpal at 2012-01-19 03:26:28

Fields changed

rhbz: => 0


Comment from dpal at 2012-01-19 03:26:28

Fields changed

rhbz: => 0


Comment from dpal at 2012-09-26 21:50:07

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


Comment from dpal at 2012-09-26 21:50:07

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


Comment from dpal at 2012-09-26 21:50:07

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


Comment from dpal at 2017-02-24 14:53:36

Metadata Update from @dpal:

  • Issue set to the milestone: Tools 1.0
@sssd-bot sssd-bot added the Closed: Fixed Issue was closed as fixed. label May 2, 2020
@sssd-bot sssd-bot closed this as completed May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed: Fixed Issue was closed as fixed.
Projects
None yet
Development

No branches or pull requests

1 participant