github/codeql-coding-standards

`RULE-8-13`: Consider assignment to struct fields as writing to pointer to object

lcartey opened this issue · 0 comments

Affected rules

  • RULE-8-13

Description

Writing to a struct field should be considered writing to the object itself.

Example

struct S {
  int* x;
};

void example_function(struct S s) { // COMPLIANT - can't be const, written to in struct call
  s->x = 1;
}