Philippe Mathieu-Daudé <[email protected]> writes:

> Replace sprintf() by safer snprintf() to format debug dump
> silencing -Wdeprecated-declarations produced by Apple clang
> 17.0.0.
>
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
>  hw/net/eepro100.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
> index aaa3eb60f8ab..44eff5fd3ad8 100644
> --- a/hw/net/eepro100.c
> +++ b/hw/net/eepro100.c
> @@ -369,7 +369,7 @@ static const char *nic_dump(const uint8_t * buf, unsigned 
> size)
>          size = 16;
>      }
>      while (size-- > 0) {
> -        p += sprintf(p, " %02x", *buf++);
> +        p += snprintf(p, sizeof(dump) - (p - dump), " %02x", *buf++);

I was going to say the whole function could be re-done to avoid the
static buffer in nic_dump but that took me to TRACE and then missing() and
I realised you probably didn't sign up to modernise the eepro100
emulation ;-)

Reviewed-by: Alex Bennée <[email protected]>


>      }
>      return dump;
>  }

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to