On Tue, Dec 09, 2025 at 03:07:04PM +0000, Peter Maydell wrote: > On Tue, 9 Dec 2025 at 15:04, Cédric Le Goater <[email protected]> wrote: > > > > Assigning the result of strstr() to a 'char *' is unsafe since > > strstr() returns a pointer into the original string which is a > > read-only 'const char *' string. Newer compilers > > Which ones? Or does this depend on how the libc headers have > marked up the strstr() prototype?
I don't believe it is compiler related, rather this is an ehancement in glibc 2.42.9000 / git master https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690 AFAICT it should work with any gcc we have Although the commit talks about C23, we get it regardless as we have _GNU_SOURCE defined. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
