]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
macro.c:871 heap-buffer-overflow
authorAlan Modra <amodra@gmail.com>
Wed, 25 Dec 2024 20:49:24 +0000 (07:19 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 25 Dec 2024 21:01:24 +0000 (07:31 +1030)
PR 32391 commit 9f2e3c21f6 fallout again.  Also fix another 'macro'
may be used uninitialized.

gas/macro.c

index 3d5a9f14341d00fd47277f3c7521b78a11c2319a..ded0645be8ddf0b40465c663c6da0d84c583e7c6 100644 (file)
@@ -868,7 +868,7 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
          /* The parent's FORMALs might contain parameters that need further
             substitution.  See gas/testsuite/gas/arm/macro-vld1.s for an
             example of this.  */
-         if (strchr (add->ptr, '\\'))
+         if (memchr (add->ptr, '\\', add->len))
            {
              sb newadd;
 
@@ -1485,7 +1485,7 @@ delete_macro (const char *name)
        }
     }
 
-  if (macro == NULL)
+  if (j < 0)
     as_warn (_("Attempt to purge non-existing macro `%s'"), copy);
 
   free (copy);