rockchip-linux / rkdeveloptool

GNU General Public License v2.0
165 stars 96 forks source link

Simplify convertChipType and fix truncation error. #67

Open flatmax opened 2 years ago

flatmax commented 2 years ago

The error stopping compilations is format-truncation.

obbardc commented 2 years ago

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

orangecms commented 2 years ago

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

flatmax commented 2 years ago

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.

orangecms commented 2 years ago

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