Skip to content

Conversation

reikoch
Copy link
Contributor

@reikoch reikoch commented Sep 5, 2020

In addition to the name of a SAS dataset also its label is read in from sas7bdat and printed the dataset's metadata is listed.

&ctx->text_blobs[0][off],
ctx->col_info[0].name_ref.offset - off
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think additional pointer validation is necessary here. We need to ensure:

  • The first memcmp does not overrun text_blob_lengths[0]
  • off is not larger than ctx->col_info[0].name_ref.offset
  • ctx->file_label is not overrun during the memcpy

Additionally: file_label likely needs to be recoded. So I suggest using readstat_convert here instead of the memcpy. That will automatically solve the third issue. Something like

readstat_convert(ctx->file_label, sizeof(ctx->file_label),
    &ctx->text_blobs[0][off], ctx->col_info[0].name_ref.offset - off, ctx->converter)

Then check the return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be addressed with the last commit

@evanmiller evanmiller merged commit 2a599d6 into WizardMac:dev Sep 25, 2020
@reikoch reikoch deleted the sas_metadata branch September 26, 2020 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants