Thomas Heijligen has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/55350 )
Change subject: libflashrom: remove flashrom_supported_programmers ......................................................................
libflashrom: remove flashrom_supported_programmers
const char **flashrom_supported_programmers(void) returns an array of strings without returning the array size or making a NULL termination. This can lead to undefined behavior when iterate over the array.
Change-Id: I0157926a654e337c14d840dd398e5576471c304f Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.de --- M libflashrom.c M libflashrom.h M libflashrom.map 3 files changed, 0 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/50/55350/1
diff --git a/libflashrom.c b/libflashrom.c index 23358c9..4a3ead6 100644 --- a/libflashrom.c +++ b/libflashrom.c @@ -114,26 +114,6 @@ }
/** - * @brief Returns list of supported programmers - * @return List of supported programmers, or NULL if an error occurred - */ -const char **flashrom_supported_programmers(void) -{ - enum programmer p = 0; - const char **supported_programmers = malloc((PROGRAMMER_INVALID + 1) * sizeof(char*)); - - if (supported_programmers != NULL) { - for (; p < PROGRAMMER_INVALID; ++p) { - supported_programmers[p] = programmer_table[p].name; - } - } else { - msg_gerr("Memory allocation error!\n"); - } - - return supported_programmers; -} - -/** * @brief Returns list of supported flash chips * @return List of supported flash chips, or NULL if an error occurred */ diff --git a/libflashrom.h b/libflashrom.h index d0d5826..f2b3e46 100644 --- a/libflashrom.h +++ b/libflashrom.h @@ -76,7 +76,6 @@
const char *flashrom_version_info(void); void flashrom_system_info(void); -const char **flashrom_supported_programmers(void); struct flashrom_flashchip_info *flashrom_supported_flash_chips(void); struct flashrom_board_info *flashrom_supported_boards(void); struct flashrom_chipset_info *flashrom_supported_chipsets(void); diff --git a/libflashrom.map b/libflashrom.map index d6dd24d..0c28a68 100644 --- a/libflashrom.map +++ b/libflashrom.map @@ -24,7 +24,6 @@ flashrom_programmer_shutdown; flashrom_set_log_callback; flashrom_shutdown; - flashrom_supported_programmers; flashrom_system_info; flashrom_version_info; local: *;