c - Warning: Suspicious pointer-to-pointer conversion (area too small) with lint -
long keyintvalue; uint8_t *value; *(long *)value = keyintvalue;
i suspicious pointer-to-pointer conversion (area small) while linting. me understand why , how rid of it?
you casting "pointer uint8_t" (uint8_t *
) long *
. uint8_t 1 byte (assuming 8 bits) available, assgnment long *
overflow following bytes (a long
has @ least 32 bits = 4 bytes) not belong object pointed to, creating undefined behaviour (ub).
note shown, value
undefined @ time of assignment, exhibiting ub.
Comments
Post a Comment