Actions
Bug #13587
closedstmf_sbd: array subscript 8 is above array bounds
Start date:
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
Description
Build errors with gcc 10:
../../common/io/comstar/lu/stmf_sbd/sbd.c: In function 'sbd_modify_lu': ../../common/io/comstar/lu/stmf_sbd/sbd.c:2684:15: error: array subscript 8 is above array bounds of 'char[8]' [-Werror=array-bounds] 2684 | mlu->mlu_buf[struct_sz - sizeof (*mlu) + 8 - 1] = 0; | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../../common/io/comstar/lu/stmf_sbd/sbd.c:49: ../../common/sys/stmf_sbd_ioctl.h:176:8: note: while referencing 'mlu_buf' 176 | char mlu_buf[8]; /* can be more than 8 */ | ^~~~~~~ ../../common/io/comstar/lu/stmf_sbd/sbd.c: In function 'sbd_set_global_props': ../../common/io/comstar/lu/stmf_sbd/sbd.c:2911:15: error: array subscript 8 is above array bounds of 'char[8]' [-Werror=array-bounds] 2911 | mlu->mlu_buf[struct_sz - sizeof (*mlu) + 8 - 1] = 0; | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../../common/io/comstar/lu/stmf_sbd/sbd.c:49: ../../common/sys/stmf_sbd_ioctl.h:138:8: note: while referencing 'mlu_buf' 138 | char mlu_buf[8]; /* likely more than 8 */ | ^~~~~~~ cc1: all warnings being treated as errors
gcc really oes not like us, when we have fixed size array and attempt to access it past array end...
Updated by Electric Monk about 1 year ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
git commit d464f34577edaa31dd6978ec04d66a57529dd2c8
commit d464f34577edaa31dd6978ec04d66a57529dd2c8 Author: Toomas Soome <tsoome@me.com> Date: 2021-03-10T08:16:02.000Z 13587 stmf_sbd: array subscript 8 is above array bounds Reviewed by: C Fraire <cfraire@me.com> Reviewed by: Andy Fiddaman <andy@omniosce.org> Approved by: Dan McDonald <danmcd@joyent.com>
Actions