Skip to content

Dangerous variable-length array (VLA) declaration found with Clang Static Analyzer #5

@xiangzhai

Description

@xiangzhai

Logic error Dangerous variable-length array (VLA) declaration main.c main line 550, 391, 550, 391

unsigned cs_size = 0;
cs_size = img_opt.checksum_size;
unsigned char checksum[cs_size];

is BAD! it is better to use:

unsigned char *checksum = NULL;
checksum = (unsigned char *)malloc(cs_size);

then remember to free it

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions