aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-03-03 15:34:04 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2021-03-03 18:51:08 +0100
commitd6177870dd2696501e3b8d3930fd5549d4acaeae (patch)
tree0e6ec3bcf9884643cc5af7d59670615944fb3a4d /gcc/d/dmd
parent5a559ace9b83cb9d7d4ba6f455ddae014f016dfb (diff)
d: Fix heap-buffer-overflow in checkModFileAlias [PR 99337]
The code wrongly assumed memcmp did not read past the mismatch. Reviewed-on: https://github.com/dlang/dmd/pull/12247 gcc/d/ChangeLog: PR d/99337 * dmd/MERGE: Merge upstream dmd a3c9bf422.
Diffstat (limited to 'gcc/d/dmd')
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/dmodule.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 690fe407278..78b454c1c64 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-7132b3537dc27cb353da75798082ffe7ea3d69a6
+a3c9bf422e7ff54d45846b8c577ee82da4234db1
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/dmodule.c b/gcc/d/dmd/dmodule.c
index a2b01f534eb..ed01858f06b 100644
--- a/gcc/d/dmd/dmodule.c
+++ b/gcc/d/dmd/dmodule.c
@@ -195,7 +195,7 @@ static void checkModFileAlias(OutBuffer *buf, OutBuffer *dotmods,
const char *m = (*ms)[j];
const char *q = strchr(m, '=');
assert(q);
- if (dotmods->length() <= (size_t)(q - m) && memcmp(dotmods->peekChars(), m, q - m) == 0)
+ if (dotmods->length() == (size_t)(q - m) && memcmp(dotmods->peekChars(), m, q - m) == 0)
{
buf->reset();
size_t qlen = strlen(q + 1);