[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tac: avoid out of bounds access
From: |
Pádraig Brady |
Subject: |
[PATCH] tac: avoid out of bounds access |
Date: |
Wed, 15 Jan 2025 17:48:08 +0000 |
This was flagged on CheriBSD on ARM Morello with the error:
"In-address space security exception (core dumped)"
triggered with: tac -s '' /dev/null
* src/tac.c (main): Ensure we don't read beyond the
end of the supplied optarg.
---
src/tac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tac.c b/src/tac.c
index e4aac77fe..f086f5345 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -553,7 +553,7 @@ main (int argc, char **argv)
G_buffer = xmalloc (G_buffer_size);
if (sentinel_length)
{
- memcpy (G_buffer, separator, sentinel_length + 1);
+ memcpy (G_buffer, separator, sentinel_length + !!*separator);
G_buffer += sentinel_length;
}
else
--
2.47.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tac: avoid out of bounds access,
Pádraig Brady <=