[PATCH v2] string: Fix OOB read on generic strncmp
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Thu Feb 23 19:10:52 GMT 2023
Hi Adhemerval,
What kind of readahead are you trying to test/fix here? It's not clear from the
patch... So with strcmp you can safely call strlen on either input, and similarly I
believe you can call strnlen on both inputs of strncmp without getting a crash.
That means it is possible to read ahead as long as you never read past a zero
byte or past the given size.
If you couldn't read even a single byte past the first mismatch it would be hard
to create efficient implementations, especially with wide vectors...
Cheers,
Wilco
More information about the Libc-alpha
mailing list