[PATCH] RISC-V: Add string length check for operands in AS
Andreas Schwab
schwab@suse.de
Tue Dec 13 09:07:55 GMT 2022
More information about the Binutils mailing list
Tue Dec 13 09:07:55 GMT 2022
- Previous message (by thread): [PATCH] RISC-V: Add string length check for operands in AS
- Next message (by thread): [PATCH] RISC-V: Add string length check for operands in AS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Dez 13 2022, Li Xu wrote:
> diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
> index 0682eb35524..b0989e4b124 100644
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -1206,7 +1206,7 @@ arg_lookup (char **s, const char *const *array, size_t size, unsigned *regnop)
> return false;
>
> for (i = 0; i < size; i++)
> - if (array[i] != NULL && strncmp (array[i], *s, len) == 0)
> + if (array[i] != NULL && (strlen(array[i]) == len) && strncmp (array[i], *s, len) == 0)
There is no need to read through array[i] twice.
if (array[i] != NULL && strncmp (array[i], *s, len) == 0
&& array[i][len] == '\0')
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
- Previous message (by thread): [PATCH] RISC-V: Add string length check for operands in AS
- Next message (by thread): [PATCH] RISC-V: Add string length check for operands in AS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list