Re: [Qemu-devel] [PATCH v3 5/5] migration: Use strnlen() for fixed-size string

2018-12-19 Thread Philippe Mathieu-Daudé
Le mer. 19 déc. 2018 00:16, Michael S. Tsirkin a écrit : > On Tue, Dec 18, 2018 at 06:51:22PM +0100, Philippe Mathieu-Daudé wrote: > > GCC 8 introduced the -Wstringop-overflow, which detect buffer overflow > > by string-modifying functions declared in , such strncpy(), > > used in global_state_st

Re: [Qemu-devel] [PATCH v3 5/5] migration: Use strnlen() for fixed-size string

2018-12-18 Thread Michael S. Tsirkin
On Tue, Dec 18, 2018 at 06:51:22PM +0100, Philippe Mathieu-Daudé wrote: > GCC 8 introduced the -Wstringop-overflow, which detect buffer overflow > by string-modifying functions declared in , such strncpy(), > used in global_state_store_running(). > > Since the global_state.runstate does not necess

Re: [Qemu-devel] [PATCH v3 5/5] migration: Use strnlen() for fixed-size string

2018-12-18 Thread Paolo Bonzini
On 18/12/18 20:33, Eric Blake wrote: >> diff --git a/migration/global_state.c b/migration/global_state.c >> index 6e19333422..c19030ef62 100644 >> --- a/migration/global_state.c >> +++ b/migration/global_state.c >> @@ -106,7 +106,7 @@ static int global_state_pre_save(void *opaque) >>   GlobalSt

[Qemu-devel] [PATCH v3 5/5] migration: Use strnlen() for fixed-size string

2018-12-18 Thread Philippe Mathieu-Daudé
GCC 8 introduced the -Wstringop-overflow, which detect buffer overflow by string-modifying functions declared in , such strncpy(), used in global_state_store_running(). Since the global_state.runstate does not necessarily contains a terminating NUL character, We had to use the QEMU_NONSTRING attri