]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
yes: avoid failure on CHERI protected systems
authorPádraig Brady <P@draigBrady.com>
Wed, 15 Jan 2025 22:08:07 +0000 (22:08 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 15 Jan 2025 22:16:30 +0000 (22:16 +0000)
* src/yes.c (main): Don't reuse the argv array as CHERI's
capability bounds do not allow for that, failing like:
  $ yes $(seq 156) | head -n1
  In-address space security exception (core dumped)

src/yes.c

index 396618cb5b5d19e5ce39f892a95aaaeec97af755..ceb7ce447b3e4373216f635e6a8f85455143c218 100644 (file)
--- a/src/yes.c
+++ b/src/yes.c
@@ -96,6 +96,11 @@ main (int argc, char **argv)
       reuse_operand_strings = false;
     }
 
+#if defined __CHERI__
+  /* Cheri capability bounds do not allow for this.  */
+  reuse_operand_strings = false;
+#endif
+
   /* Fill the buffer with one copy of the output.  If possible, reuse
      the operands strings; this wins when the buffer would be large.  */
   char *buf = reuse_operand_strings ? *operands : xmalloc (bufalloc);