rkdeveloptool icon indicating copy to clipboard operation
rkdeveloptool copied to clipboard

Simplify convertChipType and fix truncation error.

Open flatmax opened this issue 3 years ago • 4 comments

The error stopping compilations is format-truncation.

flatmax avatar Mar 06 '22 23:03 flatmax

Looks good to me! FWIW we have pulled this patch into the newly-created package for Debian.

obbardc avatar Apr 04 '22 18:04 obbardc

Can't it happen that this reads beyond the buffer? There's #57 to make it safer.

orangecms avatar May 01 '22 20:05 orangecms

It can't happen. options.chip is a string of length MAX_LINE_LEN, see here. getChipType calls convertChipType with the argument of a length >> 4 char, see here.

flatmax avatar May 01 '22 21:05 flatmax

Yes. That means that the caller has to ensure safety, while the function itself doesn't provide it. That's a lack of resiliece. :-)

orangecms avatar May 01 '22 21:05 orangecms