The code wrongly assumed memcmp did not read past the mismatch.
gcc/d/ChangeLog:
PR d/99337
* dmd/dmodule.c (checkModFileAlias): Don't read past buffer in
comparison.
(cherry picked from commit
d6177870dd2696501e3b8d3930fd5549d4acaeae)
const char *m = (*ms)[j];
const char *q = strchr(m, '=');
assert(q);
- if (dotmods->offset <= (size_t)(q - m) && memcmp(dotmods->peekString(), m, q - m) == 0)
+ if (dotmods->offset == (size_t)(q - m) && memcmp(dotmods->peekString(), m, q - m) == 0)
{
buf->reset();
size_t qlen = strlen(q + 1);