diff options
author | Thomas Heijligen <thomas.heijligen@secunet.de> | 2021-06-09 11:50:17 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-06-20 09:10:15 +0000 |
commit | 6aaa51f19a826f18ac19ccf2acf98435d3f52ce7 (patch) | |
tree | 65477cabf987a83ef88c2a746a948e0eef7e3b05 | |
parent | d3ee782e4b3f311dfd0d58427db94aaf5436d928 (diff) | |
download | flashrom-6aaa51f19a826f18ac19ccf2acf98435d3f52ce7.tar.gz flashrom-6aaa51f19a826f18ac19ccf2acf98435d3f52ce7.tar.bz2 flashrom-6aaa51f19a826f18ac19ccf2acf98435d3f52ce7.zip |
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 iterating over the
array.
Change-Id: I0157926a654e337c14d840dd398e5576471c304f
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/55350
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | libflashrom.c | 20 | ||||
-rw-r--r-- | libflashrom.h | 1 | ||||
-rw-r--r-- | libflashrom.map | 1 |
3 files changed, 0 insertions, 22 deletions
diff --git a/libflashrom.c b/libflashrom.c index 67d3ef30..d999efcd 100644 --- a/libflashrom.c +++ b/libflashrom.c @@ -114,26 +114,6 @@ const char *flashrom_version_info(void) } /** - * @brief Returns list of supported programmers - * @return List of supported programmers, or NULL if an error occurred - */ -const char **flashrom_supported_programmers(void) -{ - size_t p = 0; - const char **supported_programmers = malloc((programmer_table_size + 1) * sizeof(char*)); - - if (supported_programmers != NULL) { - for (; p < programmer_table_size; ++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 d0d58261..f2b3e46e 100644 --- a/libflashrom.h +++ b/libflashrom.h @@ -76,7 +76,6 @@ struct flashrom_chipset_info { 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 d6dd24d2..0c28a68c 100644 --- a/libflashrom.map +++ b/libflashrom.map @@ -24,7 +24,6 @@ LIBFLASHROM_1.0 { flashrom_programmer_shutdown; flashrom_set_log_callback; flashrom_shutdown; - flashrom_supported_programmers; flashrom_system_info; flashrom_version_info; local: *; |