mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 14:33:18 +02:00
Eliminate magic numbers indicating maximum column sizes in print.c
Without this the magic numbers need to be kept in sync with the maximum length of the strings printed in the corresponding column. if not, an overflow and a nasty ' '-storm occur on executing flashrom -L. Corresponding to flashrom svn r1318. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
28
flashrom.c
28
flashrom.c
@ -1709,9 +1709,37 @@ int selfcheck(void)
|
||||
msg_gerr("Programmer table miscompilation!\n");
|
||||
ret = 1;
|
||||
}
|
||||
/* It would be favorable if we could also check for correct terminaion
|
||||
* of the follwing arrays, but we don't know their size in here...
|
||||
* For 'flashchips' we check the first element to be non-null. In the
|
||||
* other cases there exist use cases where the first element can be
|
||||
* null. */
|
||||
if (flashchips == NULL || flashchips[0].vendor == NULL) {
|
||||
msg_gerr("Flashchips table miscompilation!\n");
|
||||
ret = 1;
|
||||
}
|
||||
for (flash = flashchips; flash && flash->name; flash++)
|
||||
if (selfcheck_eraseblocks(flash))
|
||||
ret = 1;
|
||||
|
||||
#if CONFIG_INTERNAL == 1
|
||||
if (chipset_enables == NULL) {
|
||||
msg_gerr("Chipset enables table does not exist!\n");
|
||||
ret = 1;
|
||||
}
|
||||
if (board_pciid_enables == NULL) {
|
||||
msg_gerr("Board enables table does not exist!\n");
|
||||
ret = 1;
|
||||
}
|
||||
if (boards_known == NULL) {
|
||||
msg_gerr("Known boards table does not exist!\n");
|
||||
ret = 1;
|
||||
}
|
||||
if (laptops_known == NULL) {
|
||||
msg_gerr("Known laptops table does not exist!\n");
|
||||
ret = 1;
|
||||
}
|
||||
#endif // CONFIG_INTERNAL == 1
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user