Skip to content

Fishy fscanf statement for OpenVZ data retrieval #192

@BenBE

Description

@BenBE

In the below code snippet the format string is kinda bad style and should be replaced by something more sensible.

(void)! fscanf(file,
"%*32u %*32s %*1c %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
"%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
"%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
"%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
"%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
"%*32u %*32u %*32u %*32u %*32u %*32u %*32u "
"%*32u %*32u %32u %32u",
&process->vpid, &process->ctid);

Furthermore the size given (32) for most arguments is far outside of sensible values for %d (sensible values would be up to 20 when considering int to map to int64_t).

Is there any documentation to point to for the format of the file we try to read there from OpenVZ? Couldn't find anything relevant (also no OpenVZ available for testing).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions